Help Center/ GaussDB(for MySQL)/ API Reference/ APIs (Recommended)/ Task Center/ Obtaining Information About a Task with a Specified ID
Updated on 2023-10-18 GMT+08:00

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:

Constraints

  • This API is used to query asynchronous tasks of the last one month in the task center.
  • After a job is generated, it takes several seconds to query the job ID.

URI

GET /v3/{project_id}/jobs

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

id

Yes

String

Task ID.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

If the following response body is returned for calling the API used to obtain a user token, the request is successful.

After the request is processed, the value of X-Subject-Token in the message header is the token value.

X-Language

No

String

Request language type. The default value is en-us.

Value:

  • en-us
  • zh-cn

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

job

GetJobInfoDetail object

Task information.

Table 5 GetJobInfoDetail

Parameter

Type

Description

id

String

Task ID.

name

String

Task name.

status

String

Task execution status.

Value:

  • Running: The task is being executed.
  • Completed: The task is successfully executed.
  • Failed: The task failed to be executed.

created

String

Creation 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.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

ended

String

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.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

process

String

Task execution progress. The execution progress (such as 60%) is displayed only when the task is being executed. Otherwise, "" is returned.

instance

GetJobInstanceInfoDetail object

Instance information of the task with the specified ID.

entities

Object

Displayed information varies depending on tasks.

fail_reason

String

Task failure information.

Table 6 GetJobInstanceInfoDetail

Parameter

Type

Description

id

String

Instance ID.

name

String

Instance name.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 8 Response body parameters

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.