Invocation examples
Function Compute APIs released on or after 2021-04-06 are compliant with the Alibaba Cloud OpenAPI specification. You can use OpenAPI Explorer to explore and debug APIs and SDKs. This topic describes how to use OpenAPI Explorer to invoke Function Compute APIs and generate SDK sample code.
Prerequisites
Invoke API
-
Log on to OpenAPI Explorer.
-
In the top navigation bar, click Cloud Products. In the search box, enter Function Compute, and then select Function Compute 3.0 from the search results.
-
In the left-side navigation pane, find InvokeFunction.
-
Configure the following parameters and click Initiate Call. The result appears on the Response tab.
For a successful asynchronous invocation, the Response tab displays a status code of
202, which means the request was accepted.The following table describes the parameters.
Parameter
Description
Region
The region where the function is located.
X-Fc-Invocation-Type
The invocation type of the function. Valid values:
-
Sync: Synchronous invocation.
-
Async: Asynchronous invocation.
functionName
The name of the function.
-
Invoke SDK
-
Log on to OpenAPI Explorer.
-
In the top navigation bar, click Cloud Products. In the search box, enter Function Compute, and then select Function Compute 3.0 from the search results.
-
In the left-side navigation pane, find InvokeFunction.
-
Configure the required parameters, select a programming language on the SDK Sample Code tab to generate the sample code, and then click Run Example.
The following table describes the parameters.
Parameter
Description
Region
The region where the function is located.
X-Fc-Invocation-Type
The invocation type of the function. Valid values:
-
Sync: Synchronous invocation.
-
Async: Asynchronous invocation.
functionName
The name of the function.
-
The result appears in the Alibaba Cloud Cloud Shell section below.