All Products
Search
Document Center

Function Compute (2.0):Call example

Last Updated:Jul 12, 2023

Versions of Function Compute API that are released on April 6, 2021 and later conform to the OpenAPI specifications of Alibaba Cloud. You can view and debug API operations and SDKs of Function Compute by using OpenAPI Explorer provided by Alibaba Cloud. This topic describes how to call API operations and SDKs of Function Compute in OpenAPI Explorer.

Prerequisite

Create a function

Call an API operation

  1. Log on to the OpenAPI Explorer.
  2. In the top navigation bar, click Select a cloud service. In the search field, enter Function Compute and click Function Compute in the search result.

  3. In the left-side navigation pane, click InvokeFunction.

  4. Configure the parameters and click Submit Request.

    image..png

The following table describes the code parameters.

Parameter

Description

Region

The region in which the function you want to execute resides.

X-Fc-Invocation-Type

The type of function invocation. Take note of the following items:

  • Sync: synchronous invocation

  • Async: asynchronous invocation

serviceName

The name of the service to which the function belongs.

functionName

The name of the function.

Use Function Compute SDKs

  1. Log on to the OpenAPI Explorer.
  2. In the top navigation bar, click Select a cloud service. In the search field, enter Function Compute and click Function Compute in the search result.

  3. In the left-side navigation pane, click InvokeFunction.

  4. Configure the parameters. Click the tab of the programming language that you want to use on the SDK Sample Code tab. The system automatically generates the sample code. Click Example.

    image..png

The following table describes the code parameters.

Parameter

Description

Region

The region in which the function you want to execute resides.

X-Fc-Invocation-Type

The type of function invocation. Take note of the following items:

  • Sync: synchronous invocation

  • Async: asynchronous invocation

serviceName

The name of the service to which the function belongs.

functionName

The name of the function.

After the execution is complete, view the execution result in the Alibaba Cloud Cloud Shell section.