Querying Task Statuses¶
Function¶
This API is used to query the execution status of a task.
Ater an asynchronous API is called, for example an API for creating BMSs or attaching or detaching disks, job_id will be returned. You can use job_id to query the task status.
URI¶
GET /v1/{project_id}/jobs/{job_id}
Table 1 lists the parameters.
Parameter | Mandatory | Description |
---|---|---|
project_id | Yes | Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
job_id | Yes | Specifies the task ID. |
Request Parameters¶
None
Example Request¶
Querying the status of a task (ID: 2c9eb2c5544cbf6101544f0635672b60)
GET https://{BMS Endpoint}/v1/bbf1946d374b44a0a2a95533562ba954/jobs/2c9eb2c5544cbf6101544f0635672b60
Response Parameters¶
Parameter | Type | Description |
---|---|---|
status | String | Specifies the task status.
|
entities | Object | Specifies the task object. For details, see Table 2. The displayed information varies depending on what tasks are executed. For tasks related to BMSs, server_id is displayed. For tasks related to NICs, nic_id is displayed. If subtasks exist, details about the subtasks are also displayed. |
job_id | String | Specifies the task ID. |
job_type | String | Specifies the task. The value can be:
|
begin_time | String | Specifies the time when the job started. The timestamp format is ISO 8601, for example, 2019-04-25T20:04:47.591Z. |
end_time | String | Specifies the time when the job ended. The timestamp format is ISO 8601, for example, 2019-04-26T20:04:47.591Z. |
error_code | String | Specifies the error code returned upon a task execution failure. |
fail_reason | String | Specifies the cause of a task execution failure. |
message | String | Specifies the message returned when an error occurs. |
code | String | Specifies the error code returned when an error occurs. For details about error codes, see section Status Codes. |
Parameter | Type | Description |
---|---|---|
sub_jobs_total | Integer | Specifies the number of subtasks. If the task has no subtasks, the value of this parameter is 0. |
sub_jobs | Array of objects | Specifies the execution information about a subtask. If the task has no subtasks, the value of this parameter is left blank. For details, see Table 3. |
Parameter | Type | Description |
---|---|---|
status | String | Specifies the task status.
|
entities | Object | Specifies the task object. The displayed information varies depending on what tasks are executed. For tasks related to BMSs, server_id is displayed. For tasks related to NICs, nic_id is displayed. For details, see Table 4. |
job_id | String | Specifies the task ID. |
job_type | String | Specifies the task type. The value can be:
|
begin_time | String | Specifies the time when the job started. The timestamp format is ISO 8601, for example, 2019-04-25T20:04:47.591Z. |
end_time | String | Specifies the time when the job ended. The timestamp format is ISO 8601, for example, 2019-04-26T20:04:47.591Z. |
error_code | String | Specifies the error code returned upon a task execution failure. |
fail_reason | String | Specifies the cause of a task execution failure. |
message | String | Specifies the message returned when an error occurs. |
code | String | Specifies the error code returned when an error occurs. For details about error codes, see section Status Codes. |
Parameter | Type | Description |
---|---|---|
server_id | String | If the task is a BMS-related operation, server_id is displayed. |
nic_id | String | If the task is a NIC-related operation, nic_id is displayed. |
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": "baremetalSingleCreate",
"begin_time": "2019-04-25T20:04:47.591Z",
"end_time": "2019-04-25T20:08:21.328Z",
"error_code": null,
"fail_reason": null
}
]
},
"job_id": "2c9eb2c5544cbf6101544f0602af2b4f",
"job_type": "baremetalBatchCreate",
"begin_time": "2019-04-25T20:04:34.604Z",
"end_time": "2019-04-25T20:08:41.593Z",
"error_code": null,
"fail_reason": null
}
Returned Values¶
Normal values
Returned Values | Description |
---|---|
200 | The request has been successfully processed. |
For details about other returned values, see Status Codes.
Error Codes¶
See Error Codes.