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.

One of the most common use cases of this template is to support multiple versions of an operation that calls the same endpoint on the service. This template enables you to overcome the limitation for that does not allow 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

UrlNew Path TemplateResulting 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.

ConnectorScenario
PlannerReroute to an updated endpoint in the same service
CognitiveServicesTextAnalyticsSupport a v2 version of an operation calling the v3 version of the endpoint in the same service
AzureADSupport a v2 version of an operation by calling the same endpoint as v1, but with an updated 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 Policy will run on the selected list of actions and triggers. If no operation is selected, this policy will apply to all operations.