Querying Encryption Tasks

Function

This API is used to query one or encryption tasks.

URI

GET /v1/{project_id}/encryptions

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 are supported.

status

No

String

Task status.

Possible values are:

  • WAITING: pending

  • PROCESSING: running

  • SUCCEEDED: completed

  • FAILED: failed

  • CANCELED: canceled

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.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

task_array

Array of EachEncryptRsp objects

Task list

is_truncated

Integer

Whether the query results are truncated

total

Integer

Total number of queried encryption tasks

Table 5 EachEncryptRsp

Parameter

Type

Description

task_id

String

Task ID

status

String

Task status.

Possible values are:

  • NO_TASK: No tasks exist.

  • WAITING: pending

  • PROCESSING: running

  • SUCCEEDED: completed

  • FAILED: failed

  • CANCELED: canceled

create_time

String

Task start time

end_time

String

Task end time

input

ObsObjInfo object

Storage location of an input file

output

ObsObjInfo object

Storage location of an output file

output_file_name

Array of strings

Name of the output file. The value is of the array type and may contain multiple names.

user_data

String

User data

description

String

Task description. If an error occurs in a transcoding task, this field indicates the error cause.

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.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Example Requests

GET https://{endpoint}/v1/{project_id}/encryptions?task_id=31207

Example Responses

Status code: 200

Encryption task queried successfully.

{
  "task_array" : [ {
    "task_id" : 31207,
    "status" : "SUCCEEDED",
    "create_time" : 20201119103952,
    "end_time" : 20201119104051,
    "input" : {
      "bucket" : "obs-apitest-01",
      "location" : "cn-north-5",
      "object" : "encrypt/m3u8/index.m3u8"
    },
    "output" : {
      "bucket" : "obs-apitest-01",
      "location" : "cn-north-5",
      "object" : "out_gamma/encrypt/001"
    },
    "output_file_name" : [ "index.m3u8" ]
  } ],
  "is_truncated" : 0,
  "total" : 1
}

Status code: 400

Failed to query the encryption task.

{
  "error_code" : "MPC.10202",
  "error_msg" : "Invalid request parameter."
}

Status Codes

Status Code

Description

200

Encryption task queried successfully.

400

Failed to query the encryption task.

Error Codes

See Error Codes.