Aliases

As your project grows, certain endpoints may have path components that can be substituted for different values. We call these "wildcard" path components aliases.

Use Case

  • Provides a rule to fuzzy match requests with similar paths to a common endpoint

Examples

Let's say we have the requests with paths /users/1, /users/2, /users/100, etc... and we want to group them together. To capture this behavior when creating an endpoint, mark the :user_id path component as an alias.

Example 1

The following endpoint with :user_id marked as an alias will match /users/1, /users/2, /users/100, etc...

/users/:user_id

Example 2

The following endpoint with :username and :repository marked as an alias will also matches requests with the paths/users/1, /users/2, /users/100, etc...

/:username/:repository

This creates an ambiguous situation where it is unclear whether the paths belong to the endpoint in Example 1 or the endpoint in Example 2. To address the ambiguity we match requests to viable endpoints with the least number of aliases, which would be the endpoint from Example 1.

How To Create

Method 1

When creating an endpoint, you have the option to configure path segment(s) as an alias. To configure an alias, select the dropdown menu to the right of the designated path segment.

Method 2

After creating an endpoint, you also have the option to configure path segment(s) as an alias. To configure an alias, select the pencil icon button underneath the Alias column for the desired path segment.

Last updated