Updated on 2023-12-25 GMT+08:00

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.

Calling Method

For details, see Calling APIs.

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 the 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:

  • 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 can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

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:

  • 1: Query results are truncated. Some results are not returned. You can configure 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

Specifies the 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 time-zone agnostic UTC time.

end_time

String

End time.

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

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

OBS object path, which complies with the OSS Object definition.

  • If this parameter is used for an input, an object must be specified.

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

file_name

String

File name

  • 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 specified by MPC.

When it is used as the output file name:

  • Specifies the name of the output file. This parameter is valid for packaging.

  • If the output file name needs to be specified during transcoding, use the output_filenames parameter.

  • This parameter is valid for parsing. If a file name is specified during parsing, the parsing parameters are written to the specified file name and the file metadata is obtained through the query API response in JSON format.

  • This parameter is invalid for snapshot capturing.

  • This parameter is invalid for conversion into animated GIFs.

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" : "example-bucket",
      "location" : "region01",
      "object" : "example-input.ts"
    },
    "output" : {
      "bucket" : "example-bucket",
      "location" : "region01",
      "object" : "example-output/example-path"
    },
    "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.