Question

Difficulty: EasyDefine API Management Policies

You are configuring an inbound policy in Azure API Management to modify the request path before it is forwarded to the backend service. The policy must redirect the client request from the public URL structure to the backend endpoint path /users/{id}. Complete the policy XML block by identifying the missing element name to rewrite the path:

Answer:<inbound>
<base />
<【rewrite-uri】 template="/users/{id}" />
</inbound>

Answer

rewrite-uri
The rewrite-uri policy modifies a request URL from the form in which it was received to the form expected by the web service that implements the API. In this scenario, it is used to redirect incoming requests to the /users/{id} path template.

Step-by-Step Solution

1
Identify the requirement to modify the request path/URL before forwarding to the backend.
The requirement is to rewrite the request URL/path to match the backend path structure.
Azure API Management provides specific inbound policies to transform request paths.
2
Select the appropriate policy element for rewriting URLs.
The rewrite-uri policy is the correct element used to change a request URL path from its public form to the form expected by the backend service.
This policy modifies the request path directly inside the inbound section using the template attribute.

Key Concept

Azure API Management URL rewriting policy
Rate this question