Querying Task Status
Function
This API is used to query the execution status of tasks, such as the status of disk creation, capacity expansion, and deletion.
URI
- URI format
GET /v1/{project_id}/jobs/{job_id}
- Parameter description
Parameter
Mandatory
Description
project_id
Yes
The project ID.
job_id
Yes
The task ID.
Request
The following example shows how to query the status of the task whose task ID is ff808081692a62c70169b4dcf9514264.
- Example requestGET https://{endpoint}/v1/{project_id}/jobs/ff808081692a62c70169b4dcf9514264
Response
- Response parameters
Parameter
Type
Description
status
String
The task status.
- SUCCESS: The task is successfully executed.
- RUNNING: The task is in progress.
- FAIL: The task fails.
- INIT: The task is being initialized.
entities
Object
The task response. For details, see •Parameters in the entities field.
The content for each type of task is different.
job_id
String
The task ID.
job_type
String
The task type.
- createVolume: creates a disk.
- batchCreateVolume: batch creates disks.
- deleteVolume: deletes a disk.
- extendVolume: expands the disk capacity.
- bulkDeleteVolume: batch deletes disks.
- deleteSingleVolume: deletes disks one by one during a batch deletion.
begin_time
String
The time when the task was started.
Time format: YYYY-MM-DDTHH:MM:SS.SSS'Z'
end_time
String
The time when the task finished.
Time format: YYYY-MM-DDTHH:MM:SS.SSS'Z'
error_code
String
The error code returned if the task execution fails.
fail_reason
String
The cause of the task execution failure.
error
Object
The error message returned if an error occurs. For details, see Parameters in the error field.
- Parameter in the entities field
Parameter
Type
Description
name
String
The disk name.
size
Integer
The disk size, in GB.
sub_jobs
Array of Objects
The information of a subtask. For details, see •Parameters in the sub_jobs field.
volume_id
String
The disk ID.
volume_type
String
The disk type.
- Parameters in the sub_jobs field
Parameter
Type
Description
status
String
The task status.
- SUCCESS: The task is successfully executed.
- RUNNING: The task is in progress.
- FAIL: The task fails.
- INIT: The task is being initialized.
entities
Object
The task response. For details, see •Parameters in the entities field.
The content for each type of task is different.
job_id
String
The task ID.
job_type
String
The task type.
- createVolume: creates a disk.
- batchCreateVolume: batch creates disks.
- deleteVolume: deletes a disk.
- extendVolume: expands the disk capacity.
- bulkDeleteVolume: batch deletes disks.
- deleteSingleVolume: deletes disks one by one during a batch deletion.
begin_time
String
The time when the task was started.
Time format: YYYY-MM-DDTHH:MM:SS.SSS'Z'
end_time
String
The time when the task finished.
Time format: YYYY-MM-DDTHH:MM:SS.SSS'Z'
error_code
String
The error code returned if the task execution fails.
fail_reason
String
The cause of the task execution failure.
- Parameter in the entities field
Parameter
Type
Description
name
String
The disk name.
size
Integer
The disk size, in GB.
volume_id
String
The disk ID.
volume_type
String
The disk type.
- Parameters in the error field
Parameter
Type
Description
message
String
The error message returned if an error occurs.
code
String
The error code returned if an error occurs.
For details about the error code, see Error Codes.
- Example response{"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": "","error_code": null,"fail_reason": null}
or
{"status": "SUCCESS","entities": {"sub_jobs": [{"status": "SUCCESS","entities": {"volume_id": "0b549095-4937-4849-8e4c-52aa027d64f7"},"job_id": "21917a8d52a19b040152a9f2f2e50041","job_type": "createVolume","begin_time": "2016-02-04T01:43:37.445Z","end_time": "2016-02-04T01:44:02.239Z","error_code": null,"fail_reason": null},{"status": "SUCCESS","entities": {"volume_id": "e7bca1a2-d3ed-434f-86f4-a1f11aa80072"},"job_id": "21917a8d52a19b040152a9f2f2f60042","job_type": "createVolume","begin_time": "2016-02-04T01:43:37.462Z","end_time": "2016-02-04T01:44:02.245Z","error_code": null,"fail_reason": null}]},"job_id": "21917a8d52a19b040152a9f2f1eb003e","job_type": "batchCreateVolume","begin_time": "2016-02-04T01:43:37.193Z","end_time": "2016-02-04T01:44:08.283Z","error_code": null,"fail_reason": null}or
{"error": {"message": "XXXX","code": "XXX"}}
Status Codes
- Normal
200
Error Codes
For details, see Error Codes.
- Function
- URI
- Request
- Response
- Status Codes
- Error Codes