Querying Job Execution Status
Function
This API is used to query the execution status of an asynchronous job.
After an asynchronous job is issued, for example, creating or deleting an ECS, performing operations on ECSs in a batch, or performing operations on ECS NICs, a job ID (job_id) will be returned, based on which you can query the execution status of the job.
For details about how to obtain job_id, see Responses (Task).
URI
GET /v1/{project_id}/jobs/{job_id}
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Specifies the project ID. For details about how to obtain the ID, see Obtaining a Project ID. |
job_id |
Yes |
Specifies the ID of an asynchronous job. |
Request
None
Response
Parameter |
Type |
Description |
---|---|---|
status |
String |
Specifies the job status.
|
entities |
Object |
Specifies the object of the job. The value of this parameter varies depending on the type of the job. If the job is an ECS-related operation, the value is server_id. If the job is a NIC operation, the value is nic_id. If a sub-Job is available, details about the sub-job are displayed. For details, see Table 3. |
job_id |
String |
Specifies the ID of an asynchronous job. |
job_type |
String |
Specifies the type of an asynchronous job. |
begin_time |
String |
Specifies the time when the job was started. |
end_time |
String |
Specifies the time when the job was finished. |
error_code |
String |
Specifies the returned error code when the job execution fails. After the job is executed successfully, the value of this parameter is null. |
fail_reason |
String |
Specifies the cause of the job execution failure. After the job is executed successfully, the value of this parameter is null. |
message |
String |
Specifies the error message returned when an error occurs in the request to query a job. |
code |
String |
Specifies the error code returned when an error occurs in the request to query a job. For details about the error code, see Returned Values for General Requests. |
Parameter |
Type |
Description |
---|---|---|
server_id |
String |
If the job is an ECS-related operation, the value is server_id. |
nic_id |
String |
If the job is a NIC-related operation, the value is nic_id. |
sub_jobs_total |
Integer |
Specifies the number of sub-jobs. |
sub_jobs |
Array of objects |
Specifies the execution information of a sub-job. For details, see Table 4. |
Parameter |
Type |
Description |
---|---|---|
status |
String |
Specifies the job status.
|
entities |
Object |
Specifies the object of the job. The value of this parameter varies depending on the type of the job. If the job is an ECS-related operation, the value is server_id. If the job is a NIC operation, the value is nic_id. For details, see Table 5. |
job_id |
String |
Specifies the sub-job ID. |
job_type |
String |
Specify the sub-job type. |
begin_time |
String |
Specifies the time when the job was started. |
end_time |
String |
Specifies the time when the job was finished. |
error_code |
String |
Specifies the returned error code when the job execution fails. After the job is executed successfully, the value of this parameter is null. |
fail_reason |
String |
Specifies the cause of the job execution failure. After the job is executed successfully, the value of this parameter is null. |
Parameter |
Type |
Description |
---|---|---|
server_id |
String |
If the job is an ECS-related operation, the value is server_id. |
nic_id |
String |
If the job is a NIC-related operation, the value is nic_id. |
errorcode_message |
String |
Indicates the cause of a sub-job execution failure. |
Example Request
Query the execution status of a specified asynchronous job.
GET https://{endpoint}/v1/{project_id}/jobs/{job_id}
Example Response
{ "status": "SUCCESS", "entities": { "sub_jobs_total": 1, "sub_jobs": [ { "status": "SUCCESS", "entities": { "server_id": "bae51750-0089-41a1-9b18-5c777978ff6d" }, "job_id": "2c9eb2c5544cbf6101544f0635672b60", "job_type": "createSingleServer", "begin_time": "2016-04-25T20:04:47.591Z", "end_time": "2016-04-25T20:08:21.328Z", "error_code": null, "fail_reason": null } ] }, "job_id": "2c9eb2c5544cbf6101544f0602af2b4f", "job_type": "createServer", "begin_time": "2016-04-25T20:04:34.604Z", "end_time": "2016-04-25T20:08:41.593Z", "error_code": null, "fail_reason": null }
Returned Values
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot