URL Path Variables

Dynamic URLs: A Path Variable can be used to handle template variables in the request URI mapping, and use them as method parameters. When calling a REST API through a URL that has a dynamic component, it is possible to embed a variable in the URI in the Context Name in the integration.

IMPORTANT TO NOTE: The configuration of a variable on an Inbound Request is different from the configuration for a variable on an outbound Request.

Inbound API Request

To include the variable in the path – wrap the variable in the path with {}. Example: If you have an URL where part of the URL changes IE if the version changes from time to time. http://inboundservice/v1/request

You would configure the Context Name as “inboundservice/{API_Version}/request” and the ‘API_Version’ (“v1” in example) variable must be set to be unmarshalled from the ‘Header’. Depending on the use case, you can have more than one path variable in a request URI:


Example Incoming: /variableContext/{variable1}/{variable2/}request


Screenshot below shows how the context name needs to be constructed for inbound APIs containing variables.

ContextNameInboundAPI V1.PNG


Outbound Request

You need to specify the variable to use from the GLU Object model and you need to specify that it must be inserted into the Header (URL), using the following format ${header.variableName}. Once the context name is setup, in the outbound request parameters, the variable must be marshalled to the header.

Depending on the use case, you can have more than one path variable in a request URI:

Example Outgoing: /variableContext/${header.variable1}/${header.variable2}/request


Screenshot below shows how the context name needs to be constructed for Connector outbound APIs containing variables.

ContextNameConnectorOutboundAPI V1.PNG


Some URL Path Variable examples below:

Example 1 – Single URL parameter:

http://specialservice/variableContext/KLM/request
http://specialservice/variableContext/BritishAirways/request
http://specialservice/variableContext/KenyanAirways/request
http://specialservice/variableContext/Emirates/request


You can then define the Context Name as follows:

variableContext/${header.varAirline}/request 

Example 2 – Variable and a query:

/${header.variable}/something/?key=value , you need to marshall the value of the query to header.

http:/x.y/specialservice//${header.variable}/Lufthansa/?key=${header.value}

Example 3 – Variable and multiple query values:

If you have values after the query with “&” (ampersand), use the HTML format: &

/PinlessRecharge?connectionsPerRoute=20&api_key=ugz27d7e4enfqcq8hkgfqqjs

Was this article helpful?

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Need Support?

Can't find the answer you're looking for?
Contact Support
Fill the form and we’ll contact you shortly

    I agree with

    cookies
    We uses cookies to make your experience on this website better. Learn more
    Accept cookies