I have a URL with template parameters.
https://test.azure-api.net/HelperFunction/{siteId}/lots/InventoryItem/{itemId}
https://test.azure-api.net/HelperFunction/122/lots/InventoryItem/12
I wanted to read the template/path parameters in inbound policy section.
I am trying as below. But it will only fetch the query string parameters. I wanted to get the path parameters.
<inbound>
<set-body>@{
JObject transBody = new JObject();
transBody.Add("Arguments",
new JObject
{
{"method", context.Request.Method},
{"parameters", context.Request.Url.QueryString},
});
//Add all json properties as arg
transBody.Add("UriPath", context.Request.Url.Path);
return transBody.ToString();
}</set-body>
<base />
</inbound>
My requirement would be to read route parameters as
"siteId" : 122,
"itemId" : 12
Any help would be appreciated.