Url alias

Introduction

Url alias features allow as to generate better url’s for the application. Using of dynamic api can generate a large url parameters set that cannot be easily read.

Alias feature adds the following functionalities:

  1. Custom path parameters that can be used on any page
  2. Alias mapping that can be used to map parameter values to other parameters
  3. Single parameter can be assigned to multiple values so multiple api calls would not require a separate parameter if the value is the same.

Custom path parameters

Each route can use up to 3 custom parameters (path1, path2 and path3).

If we had a page accessible from /my-store. We can navigate to the page also with /my-store/something_1 , /my-store/something_1/something_1 and /my-store/something_1/something_2/something_3

To read the values we can use regular custom parameters fetch.

{{ .Data.Parameters.path1 }}
{{ .Data.Parameters.path2 }}
{{ .Data.Parameters.path3 }}

Alias mapping

Aliases can be added from the url configuration menu

URL configuration URL configuration

Parameter name would be the alias (some parameter) whose value would be moved to the configured parameters.

If we had a request with a custom parameter /my-store?productId=100 then we can use the alias to set value for the dynamic input.

productId -> ErplyApi.Api.PostParam.productsRq.productID

Add alias Add alias

this would mean that we can load the product api call with the custom parameter, and we would not need to use the dynamic api parameter declaration syntax in the url as it would be aliased to the correct value.

Note that the same parameter can be mapped to multiple parameters so if there are multiple api calls that expect the same value then we can use this to just use one in the url.

Path to alias

We can also map path parameters to the aliases. For this just use the one of the path parameters (path1, path2 or path3).

path1 -> ErplyApi.Api.PostParam.productsRq.productID

This would mean that we can navigate to the page by just /my-store/101 and this would map the value of 101 to the ErplyApi.Api.PostParam.productsRq.productID parameter.