Reputation: 546
Is it possible to populate the Web Service URL based off some parameter / variable that gets sent to the Base URL?
I want to be able to forward different inbound requests to API Management to different target servers, without having to create new APIs for each new server.
Upvotes: 1
Views: 1076
Reputation: 3937
You can specify different backends with a policy. There you can add your custom logic for different query values, params, headers,...
<policies>
<inbound>
<choose>
<when condition="@(context.Request.Url.Query.GetValueOrDefault("version") == "2013-05")">
<set-backend-service base-url="http://contoso.com/api/8.2/" />
</when>
<when condition="@(context.Request.Url.Query.GetValueOrDefault("version") == "2014-03")">
<set-backend-service base-url="http://contoso.com/api/9.1/" />
</when>
</choose>
<base />
</inbound>
<outbound>
<base />
</outbound>
</policies>
API Management transformation policies
Upvotes: 1