Skip to content

Route Mapping

Route Mappings allow you to setup a custom HTTP route to any endpoint within your tenancy. This can be useful for integrating with existing systems expecting certain route patterns, or just to make an address easier to understand. It will also allow you to forward methods, meaning that you can point a POST route mapping at a PUT endpoint and all will continue working.

Standard AireGlu endpoint URLs follow this pattern:

https://domain/tenant/endpoint/environmentOrVersion

With custom routing, you can use:

https://domain/tenant/custompath

Enabling route mapping

In order to gain access to the Routing screen, a user will need the following permissions in AireIdentity:

  • list:RouteMapping
  • view:RouteMapping
  • edit:RouteMapping
  • delete:RouteMapping
  • create:RouteMapping

Creating a route mapping

From the Routing screen, select the Plus icon and you should see a dialog like this: route mapping dialog

Method to match

This is the method that calls to your custom route will be made on. This does not have to match the method of your endpoint - your calls will be forwarded correctly.

Route to match

The route you want to use to call your endpoint. This can be specified in 2 ways:

Endpoint

The endpoint that you wish to forward the route to.

Version

The version of the endpoint that you wish to forward to. If in doubt selecting Production will forward to the latest released endpoint version.

Notes

  • Custom routing is tenant-specific;
  • Ensure your custom routes are unique to avoid conflicts;
  • Be careful with regex routes, it is easy to make a path that could match multiple mappings if you make your expressions too permissive;
  • All examples assume you are running against our live hosted instance of AireGlu, you may need to replace https://glu-api.aireinnovate.com with your target runtime instance.
  • If you need to access the routing information from within an endpoint, you can use Liquid. Please see our Liquid guide

Example usage

You can configure route mapping and endpoints to create a restful URL.

For example, use route to match: ^/weatherforecast/[a-zA-Z0-9]*$

Then within the endpoint extract the last part (in this example, a postcode)

{
    {% assign pathelements = request.paths.original | split: "/" %}
    {% assign lastIndex = pathelements.size | minus: 1 %}
    "location": "{{ pathelements[lastIndex] }}"
}