• Workspace

workspace
  1. Help Center
  2. Workspace
  3. API Reference
  4. Appendix
  5. Asynchronous Job Query

Asynchronous Job Query

Function

This interface is used to query the execution status of an asynchronous job, for example, creating a desktop.

URI

  • URI format

    GET /v1.0/{project_id}/workspace-jobs/{job_id}

  • URI parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    string

    Specifies the user ID.

    job_id

    Yes

    string

    Specifies the asynchronous job ID.

Request

Request example

GET /v1.0/ac234de25c6741d2b1273da49eea1b9e/workspace-jobs/ae379d45-bb34-4613-9bda-467addca8f81

Response

  • Elements

    Name

    Type

    Description

    status

    string

    Specifies the job status. Possible values are:

    • SUCCESS: indicates that the job is successful.
    • RUNNING: indicates that the job is running.
    • FAILED: indicates that the job fails.
    • INIT: indicates that the job is being initialized.

    job_id

    string

    Specifies the job ID.

    job_type

    string

    Specifies the job type. Possible values are:

    • createDesktops: creates a desktop job.
    • applyWorkspace: applies for Workspace.
    • cancelWorkspace: cancels Workspace.

    begin_time

    string

    Specifies the begin time.

    end_time

    string

    Specifies the end time.

    error_code

    string

    Specifies the error code of a failed job.

    fail_reason

    string

    Specifies the cause of a failed job.

    message

    string

    Specifies the error message returned when a fault occurs.

    code

    string

    Specifies the error code returned when a fault occurs.

    For error codes and their corresponding meanings, see Error Code Description.

    sub_jobs_total

    integer

    Specifies the number of sub-jobs. When there is no sub-job, the value is 0. When job_type is applyWorkspace , cancelWorkspace, or resizeDesktop, there is no sub-job.

    sub_jobs

    List data structure [2]

    Specifies the execution information about sub-jobs. The list is empty when there is no sub-job.

[2] sub_jobs field data structure description

Name

Type

Description

status

string

Specifies the job status. Possible values are:

  • SUCCESS: indicates that the job is successful.
  • RUNNING: indicates that the job is running.
  • FAILED: indicates that the job fails.
  • INIT: indicates that the job is being initialized.

entities

Dictionary data structure [3]

Specifies the operation object of a job. If the job type is createDesktops, its value is desktop_id.

job_id

string

Specifies the job ID.

job_type

string

Specifies the job type.

begin_time

string

Specifies the begin time.

end_time

string

Specifies the end time.

error_code

string

Specifies the error code of a failed job.

fail_reason

string

Specifies the cause of a failed job.

message

string

Specifies the error message returned when a fault occurs.

code

string

Specifies the error code returned when a fault occurs.

For error codes and their corresponding meanings, see Error Code Description.

[3] entities field data structure description

Name

Type

Description

desktop_id

string

Specifies the desktop ID.

  • Response example
    Create a desktop.
    { 
        "job_id": "0000000057793178015779a77ac3002d", 
        "job_type": "createDesktops", 
        "begin_time": "2016-09-30T05:53:21.000Z", 
        "end_time": "2016-09-30T06:07:21.000Z", 
        "status": "SUCCESS", 
        "error_code": null, 
        "fail_reason": null, 
        "sub_jobs_total": 1, 
        "sub_jobs": [{ 
            "job_id": "7a9e0959b98742e2b39dae9cb7f193cf", 
            "job_type": "createDesktops", 
            "begin_time": "2016-09-30T05:53:21.000Z", 
            "end_time": "2016-09-30T06:07:21.000Z", 
            "status": "SUCCESS", 
            "error_code": null, 
            "fail_reason": null, 
            "message": null, 
            "entities": { 
                "desktop_id": "6db9da2a-70de-4511-8a13-a2358a03ab2b" 
            } 
        }] 
    }
    Apply for Workspace.
    {
      "job_id": "0000000058fd65560159004bd2490005",
      "job_type": "applyWorkspace",
      "begin_time": "2016-12-15T02:24:46.000Z",
      "end_time": null,
      "status": "RUNNING",
      "error_code": null,
      "fail_reason": null,
      "sub_jobs_total": 0,
      "sub_jobs": []
    }
    Cancel Workspace.
    {
      "job_id": "0000000058fd6556015900630f0b0008",
      "job_type": "cancelWorkspace",
      "begin_time": "2016-12-15T02:50:09.000Z",
      "end_time": "2016-12-15T02:53:55.000Z",
      "status": "SUCCESS",
      "error_code": null,
      "fail_reason": null,
      "sub_jobs_total": 0,
      "sub_jobs": []
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    The request syntax is incorrect and cannot be understood by the server.

    401 Unauthorized

    Authentication fails.

    403 Forbidden

    You are not authorized to perform the operation.

    404 Not Found

    The requested resource is not found.

    405 Method Not Allowed

    The method specified in the request is not allowed.

    500 Internal Server Error

    Internal service error. For details about error codes, see Error Code Description.

    503 Service Unavailable

    The service is unavailable.