Querying Snapshot Tasks

Function

This API is used to query one or more snapshot tasks. The task results will be returned, including the status, input, and output.

URI

GET /v1/{project_id}/thumbnails

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

task_id

No

Array

Task ID. A maximum of 10 task IDs can be queried at a time.

status

No

String

Task status.

Possible values are:

  • WAITING: pending

  • PROCESSING: running

  • SUCCEEDED: completed

  • FAILED: failed

  • CANCELED: deleted

start_time

No

String

Start time. If task_id is specified, this parameter is invalid. Its format is yyyymmddhhmmss. The value must be a UTC time irrelevant to the time zone.

end_time

No

String

End time. If task_id is specified, this parameter is invalid. Its format is yyyymmddhhmmss. The value must be a UTC time irrelevant to the time zone.

page

No

Integer

Page number. If task_id is specified, this parameter is invalid.

Default value: 0.

size

No

Integer

Number of records on each page. If task_id is specified, this parameter is invalid.

The value ranges from 1 to 100.

Default value: 10

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token.

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

Authorization

No

String

Authentication information. This parameter is mandatory when AK/SK-based authentication is used.

X-Project_Id

No

String

Project ID. This parameter is mandatory when AK/SK-based authentication is used. It is same as the project ID in path parameters.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory when AK/SK-based authentication is used.

x-language

No

String

Client language.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

task_array

Array of ThumbTask objects

Query results

is_truncated

Integer

Whether the query results are truncated. Possible values are:

  • 1: Query results are truncated. Some results are not returned. You can set the page and size parameters to continue the query.

  • 0: Query results are not truncated. All results are returned.

total

Integer

Total number of queried snapshot tasks

Table 5 ThumbTask

Parameter

Type

Description

task_id

String

Task ID.

A maximum of 10 task IDs can be queried at a time.

status

String

Task status

create_time

String

Start time.

If task_id is specified, this parameter is invalid. Its format is yyyymmddhhmmss. The value must be a UTC time irrelevant to the time zone.

end_time

String

End time.

If task_id is specified, this parameter is invalid. Its format is yyyymmddhhmmss. The value must be a UTC time irrelevant to the time zone.

input

ObsObjInfo object

Storage location of an input file

output

ObsObjInfo object

Storage location of an output file

output_file_name

String

Name of the generated snapshot file.

user_data

String

User data

description

String

Snapshot task description.

thumbnail_info

Array of PicInfo objects

Snapshot file information

Table 6 ObsObjInfo

Parameter

Type

Description

bucket

String

OBS bucket name

location

String

Region where an OBS bucket is located. It must be the same as the region where MPC is deployed.

object

String

File path.

  • If this parameter is used for an input, a specific path must be specified.

  • If this parameter is used for an output, only the directory for storing the outputs needs to be specified.

file_name

String

Name of an output file. This parameter is valid only for packaging tasks.

  • If this parameter is specified, the output object name is object/file_name.

  • If this parameter is not specified, the output object name is object/xxx, where xxx is allocated by MPC.

Table 7 PicInfo

Parameter

Type

Description

pic_name

String

Snapshot file name

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Example Requests

GET https://{endpoint}/v1/{project_id}/thumbnails?task_id=7684

Example Responses

Status code: 200

Snapshot task queried successfully.

{
  "task_array" : [ {
    "task_id" : 7684,
    "status" : "SUCCEEDED",
    "create_time" : 20201118121333,
    "end_time" : 20201118121336,
    "input" : {
      "bucket" : "obs-apitest-01",
      "location" : "cn-north-5",
      "object" : "ts/22.ts"
    },
    "output" : {
      "bucket" : "obs-apitest-01",
      "location" : "cn-north-5",
      "object" : "out_gamma/thumbnails/query_02"
    },
    "thumbnail_info" : [ {
      "pic_name" : "9.jpg"
    }, {
      "pic_name" : "5.jpg"
    } ]
  } ],
  "is_truncated" : 0,
  "total" : 1
}

Status code: 400

Failed to query the snapshot task.

{
  "error_code" : "MPC.10212",
  "error_msg" : "Operation failed."
}

Status Codes

Status Code

Description

200

Snapshot task queried successfully.

400

Failed to query the snapshot task.

Error Codes

See Error Codes.