Hi @Avula, Akhila,
Below is my api and policy which takes body payload:
API:
{
"openapi": "3.0.1",
"info": {
"title": "TestAPi",
"description": "API to test dynamic URL rewriting in APIM",
"version": "1.0"
},
"servers": [{
"url": "https://testapirith.azure-api.net/anything"
}],
"paths": {
"/valuation": {
"get": {
"summary": "Get valuation by ValuationID",
"description": "Get valuation by ValuationID",
"operationId": "GetValuation",
"responses": {
"200": {
"description": "Success"
}
}
}
}
},
"components": {
"securitySchemes": {
"apiKeyHeader": {
"type": "apiKey",
"name": "Ocp-Apim-Subscription-Key",
"in": "header"
},
"apiKeyQuery": {
"type": "apiKey",
"name": "subscription-key",
"in": "query"
}
}
},
"security": [{
"apiKeyHeader": []
}, {
"apiKeyQuery": []
}]
}
Policy:
<policies>
<inbound>
<base />
<set-variable name="rithtest" value="@((string)context.Request.OriginalUrl.Query.GetValueOrDefault("ValuationID"))" />
<rewrite-uri template="/anything/@(context.Variables["rithtest"])" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
Output:
If this answer was helpful, please click "Accept the answer" and mark Yes, as this can help other community members.

If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.