edit-icon download-icon

2. Configure Frontend

Last Updated: Feb 22, 2018

Step 1: Create a group

Create a group

Step 2: Bind a domain name

Domain name instructions

  1. After creating a group, go to the group details page to obtain the second-level domain name for this group, as shown in the preceding figure.
  2. Go to the website from which the external independent domain name globalservice.api.com was bought and resolve the domain name’s CNAME to the group’s second-level domain name.
  3. After resolving the CNAME, return to the group details page and click Bind Domain Name to bind globalservice.api.com to this group.
  4. As the backend uses HTTPS, an SSL certificate needs to be uploaded. The certificate content needs to be copied and pasted over because file uploading is not supported.

Step 3: Create an API: Basic Info

Basic Info sets the API group, API name, and API authentication method and type, as well as completes the API description.

Configure API basic information

  1. Go to the API list page, as shown in the preceding figure.

  2. Select the region same as the API group’s.

  3. Pay attention to security authentication.

    • Alibaba Cloud APP: Indicates that, when a customer calls your API, the API gateway will verify the APPkey and Secret, and the customer’s identity will not be authenticated.
    • No Authentication: Indicates that anyone who acquires the call method can call your API, and callers cannot be individually metered. It is not recommended that APIs without authentication be available on the data marketplace.
  4. Select the API type.

    • Public: Indicates that anyone can view this API on the “Discover APIs“ page. When APIs are available on the data marketplace, only public APIs in the group will be available.
    • Private: Indicates that no one can see this API, unless authorization is granted to an APP. When a group is available on the data marketplace, the private APIs in the group will not be available.

Step 4: Create an API: Define API request

Define API request completes the request format that a third-party user, namely the frontend, uses to call APIs on the data marketplace.

First, configure the protocol, Path, and Method. Refer to the following figure.

Configure API service information

  1. Configure the protocol.

    • The frontend configuration support both HTTP and HTTPS simultaneously. If the backend supports HTTPS, an SSL certificate must be assigned to the independent domain name.
  2. Configure the request path.

    • Path indicates the part after .com and before ? in the URL when you call an API. For details about the scenario when Path contains dynamic parameters, refer to the backend configuration process in the following sections.

      Example:

      1. If the front part of the URL you call is:
      2. https://globalservice.api.com/getapilist?command=...
      3. Your Path is:
      4. /getapilist
  3. Set Method to Post because an API with Body is to be demonstrated.

Step 5: API gateway: Configure input parameters

The input parameter definition describes the parameters that must be passed over when you call an API.

The API gateway input parameter configuration supports different parameter orders. You can configure all the parameters together and select the parameter positions, including Header, Query, Body, or Path. Building on the initial example, the input parameter configuration is as follows:

Create API input parameter definitions

  1. Note that the names of parameters are verified for uniqueness.
  2. Once again, note that this step configures the input parameters when you call an API, namely how the frontend is displayed. To configure the five parameters in this step, you need to transmit the part after ? in the URL to the command and region in the format of keyvalue, and configure the part in Query. Also, key1, key2, and group parameters must be transmitted in Body Form and configured on Body.
  3. You can use the shortcuts on the left to quickly adjust the parameter order, in relation to display definitions.

Now configuration of the frontend input parameters is complete. The next process is to configure the backend service definitions.

Thank you! We've received your feedback.