Updated on 2024-02-27 GMT+08:00

Querying Task Status

Function

This API is used to query the execution status of a task. It can be used to query the execution status of a disk creation, capacity expansion, or deletion task.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/jobs/{job_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

job_id

Yes

String

The task ID.

project_id

Yes

String

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

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The user token. It 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.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

status

String

The task status. SUCCESS: The task was successful. RUNNING: The task is in progress. FAIL: The task failed. INIT: The task is being initialized.

Enumeration values:

  • SUCCESS

  • RUNNING

  • FAIL

  • INIT

  • WAITING_EXECUTE

entities

JobEntities object

The task response information.

job_id

String

The task ID.

job_type

String

The task type.

  • *createVolume: Create a disk.

  • batchCreateVolume: Batch create disks.

  • deleteVolume: Delete a disk.

  • extendVolume: Expand the capacity of a disk.

  • bulkDeleteVolume: Batch delete disks.

  • deleteSingleVolume: Delete disks one by one during a batch deletion.

  • retypeVolume: Change the type of a disk.

begin_time

String

The start time.

end_time

String

The end time.

error_code

String

The error code returned if the task execution fails.

fail_reason

String

The cause of the task execution failure.

Table 4 JobEntities

Parameter

Type

Description

volume_type

String

The disk type.

size

Integer

The disk size, in GiB.

volume_id

String

The disk ID.

name

String

The disk name.

sub_jobs

Array of SubJob objects

The information of a subtask. If there is a subtask, other fields in entities are not returned.

Table 5 SubJob

Parameter

Type

Description

status

String

The subtask status. SUCCESS: The task was successful. RUNNING: The task is in progress. FAIL: The task failed. INIT: The task is being initialized.

Enumeration values:

  • SUCCESS

  • RUNNING

  • FAIL

  • INIT

entities

SubJobEntities object

The subtask response information.

job_id

String

The subtask ID.

job_type

String

The subtask type.

  • *createVolume: Create a disk.

  • batchCreateVolume: Batch create disks.

  • deleteVolume: Delete a disk.

  • extendVolume: Expand the capacity of a disk.

  • bulkDeleteVolume: Batch delete disks.

  • deleteSingleVolume: Delete disks one by one during a batch deletion.

  • retypeVolume: Change the type of a disk.

begin_time

String

The start time.

end_time

String

The end time.

error_code

String

The error code returned if the subtask execution fails.

fail_reason

String

The cause of the subtask execution failure.

Table 6 SubJobEntities

Parameter

Type

Description

volume_type

String

The disk type.

size

Integer

The disk size, in GiB.

volume_id

String

The disk ID.

name

String

The disk name.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error

Error object

The error message returned if an error occurs. For details, seeParameters in the error field.

Table 8 Error

Parameter

Type

Description

code

String

The error code returned if an error occurs. For the error codes and their meanings, see Error Codes.

message

String

The error message returned if an error occurs.

Example Requests

GET https://{endpoint}/v1/{project_id}/jobs/{job_id}

https://{endpoint}/v1/{project_id}/jobs/{job_id}

Example Responses

Status code: 200

OK

{
  "status" : "RUNNING",
  "entities" : {
    "volume_id" : "bdf1bb37-f20f-4266-9a04-f43e0a127376"
  },
  "job_id" : "4010a32d535527910153552b492c0002",
  "job_type" : "createVolume",
  "begin_time" : "2016-03-08T07:40:13.219Z",
  "end_time" : ""
}

Status code: 400

Bad Request

{
  "error" : {
    "message" : "XXXX",
    "code" : "XXX"
  }
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

See Error Codes.