To use API Gateway to trigger function execution, you must set Function Compute as
the backend service of the API operation and then publish the API operation. This
topic describes how to create, debug, and publish API operations in the API Gateway
console.
Step 1: Create a group
APIs are managed by group. Before you create an API operation, you must create a group.
If you have created an API group, skip this step.
- Log on to the API Gateway console.
- Select the region where the API operation is located.
Note If the region where you created the API group is not the region where you created
the service in Function Compute, API Gateway accesses the service in Function Compute
over the Internet. If you need high data security and low network latency, select
the region where you created the service in Function Compute when you create the API
group in API Gateway.
- Choose .
- Click Create Group.
- Select an instance from the drop-down list of Instance, set Group Name, and then click OK.
The API group you created is displayed in the API group list.

Step 2: Create an API operation
- In the left-side navigation pane, choose .
- Click Create API.
- Enter the required information based on the configuration wizard.
For more information about the parameters, see
Create APIs.
- In the Basic Information step, set parameters as needed, and then click Next.
- In the Define API Request step, define the API request, and then click Next.
- In the Define API Backend Service step, configure a backend service for the API operation,
and click Next.

Parameter |
Description |
Backend Service Type |
Select FunctionCompute.
|
Function Type |
Select the type of the function in Function Compute that connects to API Gateway.
Valid values:
- Event Function
- HTTP Function
|
Region |
Select the region of the function in Function Compute that connects to API Gateway.
|
Service Name |
Enter the name of the service where the function in Function Compute that connects
to API Gateway is located.
|
Function Name |
Enter the name of the function in Function Compute that connects to API Gateway. |
Function Alias |
Enter an alias for the function. Default value: LATEST. To enter another alias, make sure that you have created this alias in the Function Compute console. For more information, see Create an alias.
|
Role Arn |
Click Get Authorization. A default role is automatically assigned.
|
Backend Timeout |
Set the timeout period of the backend service. |
- In the Define Response step, configure response information for the API operation
and click Create.
After the API operation is created, it is listed on the
APIs page.

Debug the API operation
For more information about how to debug the API operation, see Debug an API operation.
Publish an API operation
- On the API List page, find the target API operation.
- Click Deploy in the Operation column.
- In the Deploy API dialog box, select the environment you want to publish the API operation, enter remarks,
and then click Deploy.
After the API operation is published, you can use this API operation of API Gateway
to access the function.