All Products
Document Center

4. Create an API

Last Updated: Oct 16, 2018

This topic describes how to create an API in API Gateway and use Function Compute as the backend service of API Gateway.


  1. (Optional) Log on to the API Gateway console. In the left-side navigation pane, select API Groups and click Create Group. Set Group Name and Description, and then click OK. Skip this step if an API group already exists.

  2. In the left-side navigation pane, select APIs and click Create API.

  3. Complete the Basic Information of the API.


  4. Define the request.

    • Subdomain Name: Set a domain that is part of a larger custom domain.
    • Request Mode: Select Request Parameter Passthrough. The body of requests sent to API Gateway are not pre-processed, and Function Compute can use the parameters in the request directly.


  5. Define Function Compute as the backend service.

  6. Click Get Authorization and in the RAM console click Confirm Authorization Policy.


  7. Specify the response.


    The Sample of Returned Results in the preceding picture is as follows:

    1. {
    2. "isBase64Encoded": false,
    3. "statusCode": 200,
    4. "headers": {},
    5. "body": ""
    6. }

Test a trigger

  1. In the API Gateway console.

  2. In the left-side navigation pane, select APIs.

  3. Select a region.

  4. Click the API you created.

  5. In the left-side navigation pane of API detail page, click Debug API.

  6. Enter the request Body and click Send Request.

  7. Verify that the test is successful, and then click Publish API.



Using Function Compute as backend service of API Gateway