Updated on 2024-08-09 GMT+08:00

Querying Task Statuses

Function

This API is used to query tasks with the same request ID.

URI

GET /v1/{project_id}/cloud-phone/jobs

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

request_id

No

String

Specifies the request ID in the response after the task request is issued. Either request_id or request_ids must be specified. If both request_id and request_ids are specified, the value of request_ids is used.

request_ids

No

String

Specifies the request IDs in the response after the task request is issued. A maximum of 20 request IDs that are separated by commas (,) are allowed. Either request_id or request_ids must be specified. If both request_id and request_ids are specified, the value of request_ids is used.

offset

No

Integer

If the offset is 0 (default value) or an integer greater than 0, all resources after the offset will be queried.

limit

No

Integer

Specifies the number of resources returned on each page. The value ranges from 1 to 100 (default). Generally, this parameter is set to 10, 20, or 50.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. It can be obtained by calling an Identity and Access Management (IAM) API. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the unique request ID.

jobs

Array of Job objects

Task information

Table 5 Job

Parameter

Type

Description

phone_id

String

Unique ID of a cloud phone. This parameter is contained in tasks related to cloud phones.

server_id

String

Unique ID of the cloud phone server. This parameter is contained in tasks related to the cloud phone server.

node_id

String

(Discarded) Unique ID of the cloud phone server. This field is included in the cloud phone service.

job_id

String

Specifies the unique ID of a task.

begin_time

String

Task processing start time, The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.

end_time

String

End time of task processing, The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.

status

Integer

Task status.

  • 1: running

  • 2: success

  • -1: failure

error_code

String

Task error code.

error_msg

String

Specifies the error message returned for the task.

execute_msg

String

Specifies the content returned after a task is executed. The value can contain a maximum of 1,024 bytes.

Example Requests

Querying the status of the task corresponding to the request ID

https://{CPH Endpoint}/v1/{project_id}/cloud-phone/jobs?request_id=6837531fd3f54550927b930180a706bf

Example Responses

Status code: 200

OK

{
  "request_id" : "6a63a18b8bab40ffb71ebd9cb80d0085",
  "jobs" : [ {
    "phone_id" : "1234567b8bab40ffb711234cb80d0234",
    "server_id" : "1e223c8e-3ad0-4bf0-a837-bc90d4f91d01",
    "node_id" : "1e223c8e-3ad0-4bf0-a837-bc90d4f91d01",
    "job_id" : "1564567b8bab40f34711234cb80d0123",
    "begin_time" : "2017-10-25T00:00:00Z",
    "end_time" : "2017-10-25T00:00:30Z",
    "status" : -1,
    "error_code" : "CPS0005",
    "error_msg" : "Phone not found."
  }, {
    "phone_id" : "abc4567b8bab40ffb711234cb80d0abc",
    "server_id" : "1e223c8e-3ad0-4bf0-a837-bc90d4f91d01",
    "node_id" : "1e223c8e-3ad0-4bf0-a837-bc90d4f91d01",
    "job_id" : "1564567b8bab40f34711234cb80d0456",
    "begin_time" : "2017-10-25T00:00:00Z",
    "end_time" : "2017-10-25T00:00:32Z",
    "status" : 2,
    "error_code" : "",
    "error_msg" : ""
  } ]
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.