Tools, FAQ, Tutorials:
Add Request Query String Parameters - 2017 Version
How to add request query string Parameters to my Azure API operation 2017 version to make it more user friendly?
✍: FYIcenter.com
If your API operation uses URL template parameters, the client system
must call it with parameter values specified in the correct position, like:
https://.../exchange-rate/USD/EUR/2020-10-10
The above URL is nice and short. But it confuses users: Is the rate for from USD to EUR or from EUR to UDS?
To avoid he confusion, you change the URL signature to use query string parameters, like
https://.../exchange-rate?from=USD&to=EUR&date=2020-10-10
One big advantage of query string parameters is that their position order is not important. So the following 3 URL are identical:
https://.../exchange-rate?from=USD&to=EUR&date=2020-10-10 https://.../exchange-rate?to=EUR&date=2020-10-10&from=USD https://.../exchange-rate?date=2020-10-10&from=USD&to=EUR
Here are steps to create template parameters:
1. Go to the publisher portal of the API Management Service.
2. Open the "First API" and add a new operation "Get exchange rate #2".
3. Enter the following to create the operation:
HTTP verb: GET URL template: /exchange-rate Rewrite URL template: /currency-exchange Display name: Get Exchange Rate #2
4. Click "Parameters" on the left. You see parameter fields displayed.
5. Click "ADD QUERY PARAMETER" repeatedly to enter 3 parameters:
NAME DESCRIPTION TYPE VALUES REQUIRED from From-currency code string USD x to To-currency code string EUR x date From-currency code string 2020-10-10 x
The picture below shows you how to create request query string parameters for an API operation:
⇒ Setup Policy to Azure API Operations - 2017 Version
⇐ Add Request URL Template Parameters - 2017 Version
2018-06-12, 3140🔥, 0💬
Popular Posts:
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...
Where to get a JSON.stringify() Example Code in JavaScript? Here is a good JSON.stringify() example ...
How to login to Azure API Management Publisher Dashboard? If you have given access permission to an ...
How to use the JSON to XML Conversion Tool at freeformatter.com? If you want to try the JSON to XML ...
How to use urllib.parse.urlencode() function to encode HTTP POST data? My form data has special char...