Help Center/ FunctionGraph/ API Reference/ APIs/ Function Invocation/ Executing a Function Asynchronously and Returning Reserved Instance IDs(Discarded)
Updated on 2023-12-11 GMT+08:00

Executing a Function Asynchronously and Returning Reserved Instance IDs(Discarded)

Function

This API is used to execute a function asynchronously and return reserved instance IDs. It is suitable for clients that execute a time-consuming task but do not need to wait for the execution result. A reserved instance ID will be returned for this API. If the instance is abnormal, you can delete it based on its ID. Note that this API is only available for whitelisted users.

URI

POST /v2/{project_id}/fgs/functions/{function_urn}/reserved-invocations

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

function_urn

Yes

String

Function URN. For details, see the function model description.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

{User defined key}

Yes

Object

Request body for executing a function asynchronously and returning reserved instance IDs.

Response Parameters

Status code: 202

Table 4 Response header parameters

Parameter

Type

Description

Content-Type

String

application/json

Table 5 Response body parameters

Parameter

Type

Description

instance_id

String

Reserved instance ID.

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Execute a function asynchronously and return reserved instance IDs.

POST /v2/{project_id}/fgs/functions/{function_urn}/reserved-invocations

{
  "body" : {
    "k" : "v"
  }
}

Example Responses

Status code: 202

Accepted

{
  "instance_id" : "048bad9b-96ae-45ad-8f12-4061a744ef9d"
}

Status code: 404

Not Found

{
  "error_code" : "FSS.1051",
  "error_msg" : "Not found the function"
}

Status Codes

Status Code

Description

202

Accepted

404

Not Found

Error Codes

See Error Codes.