All Products
Search
Document Center

Function Compute:ListAsyncTasks

Last Updated:Oct 08, 2024

Lists asynchronous tasks.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

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. Valid values: [1,100]. Default value: 20.

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
No change history