Updated on 2023-03-16 GMT+08:00

Querying the Task Execution Status List

Function Description

  • API name

    ListJobs

  • Function

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

URI

GET /v1/{project_id}/cloud-phone/jobs?request_id={request_id}

For details, see Table 1.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

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

request_id

Yes

String

Specifies the request ID in the response after the task request is issued.

NOTICE:

Either request_id or request_ids must be specified. If both request_id and request_ids are specified, the value of request_ids prevails.

request_ids

Yes

String

If there are multiple request IDs in the response, use commas (,) to separate them. A maximum of 20 request IDs are allowed.

NOTE:

If both request_id and request_ids are specified, the value of request_ids prevails.

offset

No

Integer

Specifies the offset.

The offset must be an integer greater than 0 but less than the number of resources. All resources after this offset will be queried.

limit

No

Integer

Specifies the number of resources to be returned on each page.

Value range: 1–100

Generally, set this parameter to 10, 20, or 50.

Request

  • Request parameters

    None

  • Example request
    1
    GET https://{CPH Endpoint}/v1/{project_id}/cloud-phone/jobs?request_id=6837531fd3f54550927b930180a706bf
    

Response

  • Response parameters

    Parameter

    Type

    Description

    request_id

    String

    Specifies the request ID, which is unique.

    jobs

    Array of objects

    Specifies the task information. For details, see Table 2.

    Table 2 Data structure description of job

    Parameter

    Type

    Description

    phone_id

    String

    Specifies the unique ID of a cloud phone. This parameter is contained in tasks related to cloud phones.

    server_id

    String

    Specifies the unique ID of a cloud phone server. This parameter is contained in tasks related to cloud phone servers.

    node_id

    String

    (Discarded) Specifies the unique ID of a cloud phone server. This parameter is contained in server-related tasks.

    job_id

    String

    Specifies the unique ID of a task.

    begin_time

    String

    Specifies the task start time.

    It is a UTC time in YYYY-MM-DDTHH:MM:SSZ format.

    end_time

    String

    Specifies the task end time.

    It is a UTC time in YYYY-MM-DDTHH:MM:SSZ format.

    status

    Integer

    Specifies the task status.

    • 1: The task is running.
    • 2: The task succeeds.
    • -1: The task fails.

    error_code

    String

    Specifies the task error code.

    error_msg

    String

    Specifies the task error code message.

    execute_msg

    String

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

  • Example response
    {
        "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": "" 
            }
        ]
    }

Returned Values

See Returned Values.

Error Codes

See Error Codes.