Example - usage scenarios of URL aliases

About this task

The following section explains how an API consumer can invoke an API for which a URL alias is created.This example uses the RESTCalcService API. Suppose the RESTCalcService API is activated in API Gateway and the following are the gateway endpoints for this API.

http://test:2225/gateway/RESTCalcService/1.0

http://test:4000/gateway/RESTCalcService/1.0

http://test:4010/gateway/RESTCalcService/1.0

http://test:5555/gateway/RESTCalcService/1.0

Also, the RESTCalcService consists of the postCalc resource path that adds two numbers.

If this API is published to the API consumer, then the invocation endpoint for the consumer might appear as follows.

https://test:5555/gateway/RESTCalcService/1.0/postCalc

If you do not want to expose the API name and path information or if you want to shorten the invocation endpoint as it is complex, then you can create a custom URL alias.

To create a URL alias.

Procedure

  1. Open the menu options and select Administration.
  2. Select General > URL.
  3. Click Add URL alias and provide the following values:
    Field Value
    Alias calc
    Default URL path gateway/RESTCalcService/1.0/postCalc
  4. Click Save.

What to do next

Suppose, the URL alias name that is provided when you create a URL alias is calc. You can now expose the https://test:5555/calc invocation endpoint to the API consumer instead of https://test:5555/gateway/RESTCalcService/1.0/postCalc.

With the default URL path specified in the alias configuration, the API consumer can use this URL alias for any ports of gateway endpoint that is shown in the API details page, for example,

  • http://test:2225/calc
  • http://test:4000/calc
  • http://test:4010/calc
  • http://test:5555/calc