I am working with Azure API Management (APIM) and have created an API without defining specific operations, applying policies at the All operations level. The API is intended to function in a No-Operation mode, where policies at the API level should rout
Anand Singh
0
Reputation points
I am working with Azure API Management (APIM) and have created an API without defining specific operations, applying policies at the All operations level.
The API is intended to function in a No Operation mode, where policies at the API level should route requests to different backends based on the URL path.
However, when sending requests via Postman, I consistently receive:
{
"statusCode": 404,
"message": "Resource not found"
}
Used Policy for testing
<inbound>
<base />
<choose>
<when condition="@(context.Request.OriginalUrl.Path.Contains("/get"))">
<set-backend-service base-url="https://httpbin.org" />
<rewrite-uri template="/get" />
</when>
<when condition="@(context.Request.OriginalUrl.Path.Contains("/posts"))">
<set-backend-service base-url="https://jsonplaceholder.typicode.com" />
<rewrite-uri template="/posts/1" />
</when>
<otherwise>
<return-response>
<set-status code="404" reason="Not Found" />
<set-body>@("Requested resource not found")</set-body>
</return-response>
</otherwise>
</choose>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
Sign in to answer