All Products
Search
Document Center

Intelligent Media Management:GetTask

Last Updated:Dec 11, 2024

Queries information about an asynchronous task. Intelligent Media Management (IMM) has multiple asynchronous data processing capabilities, each of which has its own operation for creating tasks. For example, you can call the CreateFigureClusteringTask operation to create a face clustering task and the CreateFileCompressionTask operation to create a file compression task. The GetTask operation is a general operation. You can call this operation to query information about asynchronous tasks by task ID or type.

Operation description

Before you call this operation, make sure that you are familiar with the billing of IMM.

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
imm:GetTaskget
*Project
acs:imm:{#regionId}:{#accountId}:project/{#ProjectName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ProjectNamestringYes

The name of the project. You can obtain the name of the project from the response of the CreateProject operation.

immtest
TaskTypestringYes

The type of the task. For information about valid values, see Task types.

VideoLabelClassification
TaskIdstringYes

The ID of the task. You can obtain the ID of a task after you create the task.

c2b277b9-0d30-4882-ad6d-ad661382****
RequestDefinitionbooleanNo

Specifies whether to return the initial request parameters that are used to create the task. Default value: False.

True

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

2C5C1E0F-D8B8-4DA0-8127-EC32C771****
ProjectNamestring

The project name.

immtest
EventIdstring

The event ID.

2F6-1Bz99Xi93EnRpNEyLudILJm****
Statusstring

The status of the task. Valid values:

  • RUNNING: The task is running.
  • Succeeded: The task is successful.
  • Failed: The task failed.
Running
Codestring

The error code of the task.

ResourceNotFound
Messagestring

The error message of the task.

The specified resource project is not found.
StartTimestring

The start time of the task.

2021-12-24T03:01:41.662060377Z
EndTimestring

The end time of the task.

2021-12-24T03:01:49.480109219Z
UserDatastring

The user data of the task.

{"ID": "user1","Name": "test-user1","Avatar": "http://example.com?id=user1"}
TaskTypestring

The type of the task. For more information, see Task types.

VideoLabelClassification
TaskIdstring

The task ID.

c2b277b9-0d30-4882-ad6d-ad661382****
Tagsobject

The tags. This parameter is returned only if you specified Tags when you created the task.

{"test": "val1"}
TaskRequestDefinitionstring

The initial request parameters used to create the task.

{ "ProjectName":"test-project", "CompressedFormat":"zip", "TargetURI":"oss://test-bucket/output/test.zip", "Sources":[{"URI":"oss://test-bucket/input/test.jpg"}] }
Progressinteger

The task progress. Valid values: 0 to 100. Unit: %.

Note This parameter is valid only if the task is in the Running state.``
100

Examples

Sample success responses

JSONformat

{
  "RequestId": "2C5C1E0F-D8B8-4DA0-8127-EC32C771****",
  "ProjectName": "immtest",
  "EventId": "2F6-1Bz99Xi93EnRpNEyLudILJm****",
  "Status": "Running",
  "Code": "ResourceNotFound",
  "Message": "The specified resource project is not found.",
  "StartTime": "2021-12-24T03:01:41.662060377Z",
  "EndTime": "2021-12-24T03:01:49.480109219Z",
  "UserData": "{\"ID\": \"user1\",\"Name\": \"test-user1\",\"Avatar\": \"http://example.com?id=user1\"}",
  "TaskType": "VideoLabelClassification",
  "TaskId": "c2b277b9-0d30-4882-ad6d-ad661382****",
  "Tags": {
    "test": "val1"
  },
  "TaskRequestDefinition": "{\n\t\"ProjectName\":\"test-project\",\n\t\"CompressedFormat\":\"zip\",\n\t\"TargetURI\":\"oss://test-bucket/output/test.zip\",\n\t\"Sources\":[{\"URI\":\"oss://test-bucket/input/test.jpg\"}]\n}",
  "Progress": 100
}

Error codes

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

Change history

Change timeSummary of changesOperation
2023-05-11The request parameters of the API has changed. The response structure of the API has changedView Change Details