Tools, FAQ, Tutorials:
Add Request URL Template Parameters - 2017 Version
How to add request URL Template Parameters to my Azure API operation 2017 version to make it more user friendly?
✍: FYIcenter.com
If your API Operation requires some key parameters,
you put them as template parameters in the URL template of the operation.
Using template parameters reduces the need for providing parameters in the request body and simplifies the request.
If you want to build an API operation to returning the exchange rate of given currencies, you need 3 input parameters from the request: from-currency, to-currency and date.
You can design your API operation with no template parameter and put all 3 parameters in the request body:
URL template: /exchange-rate Request body: from=USD&to=EUR&date=2020-10-10
You can design your API operation with template parameters and no request body::
URL template: /exchange-rate/{from}/{to}/{date}
Request body: none
Obviously, the second design with template parameter is much easier for client systems to call:
https://.../exchange-rate/USD/EUR/2020-10-10
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".
3. Enter the following to create the operation:
HTTP verb: GET
URL template: /exchange-rate/{from}/{to}/{date}
Rewrite URL template: /currency-exchange/{from}/{to}/{date}
Display name: Get Exchange Rate
The picture below shows you how to create Request URL template parameters for an API operation:
⇒ Add Request Query String Parameters - 2017 Version
⇐ View Effective Policy of API Operation - 2017 Version
2018-06-12, ∼4760🔥, 0💬
Popular Posts:
What is EPUB 2.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 2.0 Metadata "dc:publisher" ...
dev.FYIcenter.com is a Website for software developer looking for software development technologies,...
How to Install Docker Desktop on Windows 10? You can follow this tutorial to Install Docker Desktop ...
What is EPUB 3.0 Metadata "dcterms:modified" property? EPUB 3.0 Metadata "dcterms:modified" is a req...
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...