I'm using the Azure API Management to transform the incoming query string into another query string.
My transformation code is:
<policies>
<inbound>
<rewrite-uri template="api/primes?a={a}&b={b}" />
<base />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
When I try to save the edits, the error appears:
One or more fields contain incorrect values:
'=' is an unexpected token. The expected token is ';'. Line 15, position 50.
which refers to the equals symbol as in a={a}
. How do I correct the template of the rewrite-uri
? The input url is for example https://example.com/sum?a=7&b=5
.
Query parameters are a defined set of parameters attached to the end of a url. They are extensions of the URL that are used to help define specific content or actions based on the data being passed. To append query params to the end of a URL, a '? ' Is added followed immediately by a query parameter.
What are query string parameters? Query string parameters are extensions of a website's base Uniform Resource Locator (URL) loaded by a web browser or client application. Originally query strings were used to record the content of an HTML form or web form on a given page.
Try replacing:
<rewrite-uri template="api/primes?a={a}&b={b}" />
With:
<rewrite-uri template="api/primes?a={a}&b={b}" />
Find more details at https://azure.microsoft.com/en-us/blog/policy-expressions-in-azure-api-management/.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With