Executing a Function Asynchronously and Returning Reserved Instance IDs
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.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
POST /v2/{project_id}/fgs/functions/{function_urn}/reserved-invocations
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Parameter description: Project ID. For details, see Obtaining a Project ID. Constraints N/A Value range: 32 characters, including letters and digits. Default value: N/A |
| function_urn | Yes | String | Parameter description: URN of the function. For details, see Function Model. Constraints N/A Value range: Only letters, digits, underscores (_), hyphens (-), and colons (:) are allowed. Default value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Parameter description: User token. The token can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. Constraints N/A Value range: N/A Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| {User defined key} | Yes | Object | Function execution request body, in JSON format. |
Response Parameters
Status code: 202
| Parameter | Type | Description |
|---|---|---|
| Content-Type | String | application/json |
| Parameter | Type | Description |
|---|---|---|
| instance_id | String | Reserved instance ID. |
Status code: 404
| 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" : "",
"requestContext" : {
"apiId" : "bc1dcffd-xx",
"requestId" : "xxx",
"stage" : "RELEASE"
},
"queryStringParameters" : {
"responseType" : "html"
},
"httpMethod" : "GET",
"pathParameters" : null,
"headers" : {
"accept-language" : "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"accept-encoding" : "gzip, deflate, br",
"x-forwarded-port" : "443",
"x-forwarded-for" : "127.0.0.1",
"x-forwarded-proto" : "https"
},
"path" : "/apig-event-template",
"isBase64Encoded" : true
} Example Responses
Status code: 202
{
"instance_id" : "048bad9b-96ae-45ad-8f12-4061a744ef9d"
} Status code: 404
{
"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.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot