This topic describes how to create an API in API Gateway and use Function Compute as the backend service of API Gateway.
(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.
In the left-side navigation pane, select APIs and click Create API.
Complete the Basic Information of the API.
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.
Define Function Compute as the backend service.
Click Get Authorization and in the RAM console click Confirm Authorization Policy.
Specify the response.
The Sample of Returned Results in the preceding picture is as follows:
In the API Gateway console.
In the left-side navigation pane, select APIs.
Select a region.
Click the API you created.
In the left-side navigation pane of API detail page, click Debug API.
Enter the request Body and click Send Request.
Verify that the test is successful, and then click Publish API.