Set Host URL

Template ID: dynamichosturl

Replaces host URL with the URL generated from the template. This template is available in Power Apps and Power Automate.

The target use cases for this template are scenarios where the request has to be routed to a backend dynamic host url. The url depends on one or more connection parameters, query parameters, or headers. The URL template parameter supports expressions to enable this scenario. If needed, the operations parameter allows you to scope down the application to a specific subset of operations.

If you use this template, keep in mind that the host url defined in the connector will no longer be relevant for the corresponding operations. The host url will always be replaced by the value that is evaluated by this template.

Examples

Let’s look at some examples that use the following parameters.

headers: test=foo

connectionParameters: cat=bar; subPath=path

queryParameters: domain=pqr

Url TemplateResulting host url
https://@header('test').abc.xyzhttps://foo.abc.xyz
https://@connectionParameters('cat').abc.xyzhttps://bar.abc.xyz
https://test.abc.xyzhttps://test.abc.xyz
https://@header('test').abc.@queryParameters('domain')/@connectionParameters('subPath')https://foo.abc.pqr/path
https://@header('test123', 'default').abc.xyzhttps://default.abc.xyz

Examples from open-sourced connectors

We have multiple instances of this template being used in our open-sourced connectors repository.

ConnectorScenario
Key VaultHost URL depends on the key vault name which is a connection parameter
Engagement CloudHost URL depends on the region, which is passed as a header
Cognitive Service Text AnalyticsHost URL is supplied by the user as a connection parameter but also has a default

Input Parameters

Name Key Required Type Description
Url Template x-ms-apimTemplateParameter.urlTemplate True String Specifies template from which host URL will be generated. This parameter supports expressions. Click here to learn more about expressions.
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.