Route Request
Template ID: routerequesttoendpoint
Routes incoming requests to a specified endpoint on the same service. This template is available in Power Apps and Power Automate.
In this article
One of the most common use cases of this template is to support multiple versions of an operation calling the same endpoint on the service. This template enables you to overcome the limitation of not being able to have two or more operations to have the same path in the swagger.
Examples
Let’s look at some examples that use the following parameters.
headers: test=foo
queryParameters: version=v2
Url | New Path Template | Resulting url |
https://test.abc.xyz/v2/get/{id} | /get/{id} | https://test.abc.xyz/get/{id} |
https://test.abc.xyz/get/{id} | /@queryParameters('version')/get/{id} | https://test.abc.xyz/v2/get/{id} |
https://test.abc.xyz/get/{id} | /@header('version', 'v1')/get/{id} | https://test.abc.xyz/v1/get/{id} |
Examples from open-sourced connectors
We have multiple instances of this template being used in our open-sourced connectors repository and here are a few of them.
Connector | Scenario | |
Planner | Reroute to an updated endpoint in the same service | |
CognitiveServicesTextAnalytics | Support a v2 version of an operation calling the v3 version of the endpoint in the same service | |
AzureAD | Support a v2 version of the an operation calling the same endpoint as v1 but with updated/reconfigured swagger definition |
Input Parameters
Name | Key | Required | Type | Description |
---|---|---|---|---|
New path |
x-ms-apimTemplateParameter.newPath | True | String | Specifies the relative path on the same service where requests will be routed to. This parameter supports expressions. Click here to learn more about expressions. |
Method |
x-ms-apimTemplateParameter.httpMethod | String | Specifies the HTTP method to use. If not specified, the original HTTP method will be used. | |
Operations |
x-ms-apimTemplate-operationName | Array | List of actions and triggers to which the policy will apply to. If no operation is selected, this policy will apply to all operations. |