Obtaining Information About a Task with a Specified ID
Function
This API is used to obtain task information from the task center. Before calling this API:
- Learn how to authenticate it.
- Obtain the required region and endpoint.
Constraints
- This API is used to query asynchronous tasks of the last one month in the task center.
- After a task is generated, it takes several seconds to query the task ID.
URI
GET /v3/{project_id}/jobs
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. Constraints N/A Range The value contains 32 characters. Only letters and digits are allowed. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | Yes | String | Definition Task ID. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. To obtain this value, call the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the token value. Constraints N/A Range N/A Default Value N/A |
| X-Language | No | String | Definition Request language type. Constraints N/A Range
Default Value en-us |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| job | GetJobInfoDetail object | Definition Task information. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Task ID. Range The value is the same as that of the input parameter. |
| name | String | Definition Task name. Range N/A |
| status | String | Definition Task execution status. Range
|
| created | String | Definition Creation time. The format is yyyy-mm-ddThh:mm:ssZ. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100. Range N/A |
| ended | String | Definition End time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100. Range N/A |
| process | String | Definition Task execution progress. Range The execution progress (such as 60%) is only displayed when the task is being executed. Otherwise, "" is returned. |
| instance | GetJobInstanceInfoDetail object | Definition Instance information of the task with the specified ID. |
| entities | Object | Definition Displayed information varies depending on tasks. |
| fail_reason | String | Definition Task failure information. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Instance ID, which uniquely identifies an instance. Range The value contains 36 characters with a suffix of in07. Only letters and digits are allowed. |
| name | String | Definition Instance name. Range The name must start with a letter and consist of 4 to 64 characters. Only letters (case-sensitive), digits, hyphens (-), and underscores (_) are allowed. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Example Request
Obtaining information about a task with a specified ID
GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/jobs?id=a9767ede-fe0f-4888-9003-e843a4c90514 Example Response
Status code: 200
In the response example, some tasks in the task center are used as examples.
Success.
{
"job" : {
"id" : "31b8ae23-c687-4d80-b7b4-42a66c9bb886",
"name" : "CreateGaussDBforMySQLInstance",
"status" : "Completed",
"created" : "2018-08-06T10:41:14+0800",
"ended" : "2018-08-06T16:41:14+0000",
"process" : "",
"instance" : {
"id" : "a48e43ff268f4c0e879652d65e63d0fbin07",
"name" : "DO-NOT-TOUCH-mgr2-mysql-single"
},
"entities" : {
"instance" : {
"endpoint" : "192.168.1.203:3306",
"type" : "Cluster",
"datastore" : {
"type" : "gaussdb-mysql",
"version" : "8.0"
}
},
"resource_ids" : [ "a48e43ff268f4c0e879652d65e63d0fbin07.vm", "a48e43ff268f4c0e879652d65e63d0fbin07.volume" ]
}
}
} Status Code
For details, see Status Codes.
Error Code
For details, see Error Codes.