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 (Jobs).
Debugging
You can debug this API in API Explorer.
URI
GET /v1/{project_id}/jobs/{job_id}
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
project_id |
Yes |
Definition Specifies the project ID. For details about how to obtain the ID, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
|
job_id |
Yes |
Definition Specifies the ID of an asynchronous job. It can be obtained from the response of the asynchronous job. Constraints N/A Range N/A Default Value N/A |
Request
None
Response
|
Parameter |
Type |
Description |
|---|---|---|
|
status |
String |
Definition Specifies the job status.
NOTE:
Jobs in the SUCCESS or FAIL state will be automatically deleted one day later. The PENDING_PAYMENT status indicates that the order for creating a yearly/monthly ECS or modifying the specifications of a yearly/monthly ECS has been submitted but the payment process is still pending. If the order is canceled, the status will not be automatically updated. The job will be automatically deleted 14 days later. Range
|
|
entities |
Object |
Definition Specifies the object of the job. The displayed information varies depending on what tasks are executed. For details, see Table 3. Range
|
|
job_id |
String |
Definition Specifies the ID of an asynchronous job. Range N/A |
|
job_type |
String |
Definition Specifies the type of an asynchronous job. Range Only some common job types are listed below. For the actual job types, see the response. The type is the corresponding asynchronous request API. For example:
|
|
begin_time |
String |
Definition Specifies the time when the job was started. Range N/A |
|
end_time |
String |
Definition Specifies the time when the job was finished. Range N/A |
|
error_code |
String |
Definition Specifies the returned error code when the job execution fails. Range After the job is executed successfully, the value of this parameter is null. |
|
fail_reason |
String |
Definition Specifies the cause of the job execution failure. Range After the job is executed successfully, the value of this parameter is null. |
|
message |
String |
Definition Specifies the error message returned when an error occurs in the request to query a job. Range N/A |
|
code |
String |
Definition 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. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
server_id |
String |
Definition Displayed when the job is ECS-related. Range N/A |
|
nic_id |
String |
Definition If the job is a NIC-related operation, the value is nic_id. Range N/A |
|
sub_jobs_total |
Integer |
Definition Specifies the number of sub-jobs. Range N/A |
|
sub_jobs |
Array of objects |
Definition Specifies the execution information of a sub-job. For details, see Table 4. Range N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
status |
String |
Definition Specifies the job status. Range
|
|
entities |
Object |
Definition Specifies the object of the job. The displayed information varies depending on what tasks are executed. Range
For details, see Table 5. |
|
job_id |
String |
Definition Specifies the sub-job ID. Range N/A |
|
job_type |
String |
Definition Specify the sub-job type. Range Only some common job types are listed below. For the actual job types, see the response. The type is the corresponding asynchronous request API. For example:
|
|
begin_time |
String |
Definition Specifies the time when the job was started. Range N/A |
|
end_time |
String |
Definition Specifies the time when the job was finished. Range N/A |
|
error_code |
String |
Definition Specifies the returned error code when the job execution fails. Range After the job is executed successfully, the value of this parameter is null. |
|
fail_reason |
String |
Definition Specifies the cause of the job execution failure. Range After the job is executed successfully, the value of this parameter is null. |
|
Parameter |
Type |
Description |
|---|---|---|
|
server_id |
String |
Definition Displayed when the job is ECS-related. Range N/A |
|
nic_id |
String |
Definition If the job is a NIC-related operation, the value is nic_id. Range N/A |
|
errorcode_message |
String |
Definition Specifies the cause of a sub-job execution failure. Range N/A |
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