bobenose Posted August 28 Report Share Posted August 28 (edited) Specifically - I am looking at emulating an existing REST api that is in the style: /command1/command2/<variable>/command3-related-to-variable one example where this occurs is with network devices port or VLAN ids (eg: <url>/port/3/speed ) Obviously if it is my REST api, I could just do /port/speed and have a variable passed for the port number (eg: /port/speed?port=3 ) -- but I don't get to define everyone's API... In my case, I am trying to emulate such behavior, so I need to setup a web resource that (ideally) would behave identically to the API, hence /port/3/speed etc is desired. But I see no obvious way to do so in LV (2024 SP3) Edited August 28 by bobenose Quote Link to comment
bobenose Posted September 4 Author Report Share Posted September 4 Answered: https://www.ni.com/docs/en-US/bundle/labview/page/understanding-url-mappings-and-query-strings-in-web-services-real-time-windows.html?srsltid=AfmBOopGM5Aom7rH3ofPKKWSHNo1Ye6RrmFtwG6Zh_QJFtInuTGsTOJO Future me (or you) - simply set the Web Service Properties -> HTTP Method VI settings -> URL Mapping to something such as <base url>/path1/path2/:variable1/path3/:variable2 ) and variable1 and variable2 will be passed into the VI as a path parameter rather than the query parameter (eg: <base url>/path1/path2/path3/?variable1=___&variable2=_____ ) 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.