All Products
Search
Document Center

Function Compute:ListAsyncTasks

Last Updated:Dec 09, 2024

Lists asynchronous tasks.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
fc:ListAsyncTaskslist
*All Resources
*
    none
none

Request syntax

GET /2023-03-30/functions/{functionName}/async-tasks HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
functionNamestringYes

The function name.

my-func
prefixstringNo

The ID prefix of asynchronous tasks. If this parameter is specified, a list of asynchronous tasks whose IDs match the prefix is returned.

job-
nextTokenstringNo

The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.

MTIzNCNhYmM=
limitintegerNo

The number of asynchronous tasks to return. The default value is 20. Valid values: [1,100].

10
qualifierstringNo

The version or alias of the function.

LATEST
statusstringNo

The state of asynchronous tasks. The following items list the states of an asynchronous task:

  • Enqueued: The asynchronous invocation is enqueued and is waiting to be executed.
  • Succeeded: The invocation is successful.
  • Failed: The invocation fails.
  • Running: The invocation is being executed.
  • Stopped: The invocation is terminated.
  • Stopping: The invocation is being terminated.
  • Invalid: The invocation is invalid and not executed due to specific reasons. For example, the function is deleted.
  • Expired: The maximum validity period of messages is specified for asynchronous invocation. The invocation is discarded and not executed because the specified maximum validity period has elapsed.
  • Retrying: The asynchronous invocation is being retried due to an execution error.
Running
startedTimeBeginlongNo

The start time of the period during which the asynchronous tasks are initiated.

1640966400000
startedTimeEndlongNo

The end time of the period during which the asynchronous tasks are initiated.

1640966400000
sortOrderByTimestringNo

The order in which the returned asynchronous tasks are sorted.

  • asc: in ascending order.
  • desc: in descending order.
asc
includePayloadbooleanNo

Specifies whether to return input parameters of the asynchronous tasks. Valid values:

  • true: returns the invocationPayload parameter in the response.
  • false: does not return the invocationPayload parameter in the response.
Note The invocationPayload parameter indicates the input parameters of an asynchronous task.
true

Response parameters

ParameterTypeDescriptionExample
ListAsyncTaskOutput

The response parameters.

Examples

Sample success responses

JSONformat

{
  "nextToken": "",
  "tasks": [
    {
      "alreadyRetriedTimes": 3,
      "destinationStatus": "Succeeded",
      "durationMs": 1000,
      "endTime": 1633449590000,
      "events": [
        {
          "eventDetail": "body",
          "eventId": 1,
          "status": "Succeeded",
          "timestamp": 1647420449721
        }
      ],
      "functionArn": "acs:fc:cn-shanghai:1234/functions/my-func",
      "instanceId": "D4-*******9FD1-882707E",
      "qualifier": "prod",
      "requestId": "e026ae92-61e5-472f-b32d-1c9e3c4e****",
      "returnPayload": "result",
      "startedTime": 1633449590000,
      "status": "Running",
      "taskErrorMessage": "UnhandledInvocationError",
      "taskId": "e026ae92-61e5-472f-b32d-1c9e3c4e****",
      "taskPayload": "body"
    }
  ]
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-10-23The internal configuration of the API is changed, but the call is not affectedView Change Details