Several times you come across a situation where you should use send-request Policy to make use of an external service to perform complex processing functions and return data to the API management service that can be used for further policy processing.
The send-request policy looks like this:
Now if you want to use Query String Parameters in the URL under set-url policy used above using set-query-parameter policy then it is not allowed and you will not be able to even save your configured policy. Generally, we get confused and try to make use of this policy inside send-request policy but set-query-parameter policy is used to add, replace value of, or deletes request query string parameter. It Can be used to pass query parameters expected by the backend service which are optional or never present in the request according to this link https://msdn.microsoft.com/library/azure/7406a8ce-5f9c-4fae-9b0f-e574befb2ee9#SetQueryStringParameter
Now the question is how to pass query string parameters? It’s very simple and logical, we can make use of APIM variables in this scenario.
Firstly, setting the variables with some values:
And secondly making use of these variables inside send-request policy:
Refer this link for more details https://github.com/Microsoft/azure-docs/blob/master/articles/api-management/api-management-sample-send-request.md
Please let me know your queries.
Happy Coding!
This post first appeared on MSDN Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The MSDN Blogs., please read the originial post: here