Help Center> Document Database Service> API Reference> APIs V3.0 (Recommended)> Task Management> Obtaining Information About a Task with a Specified ID
Updated on 2022-12-12 GMT+08:00

Obtaining Information About a Task with a Specified ID

Description

This API is used to obtain information about a task with a specified ID in the task center.

Restrictions

  • Currently, only asynchronous tasks in the task center of DDS Community Edition within one month can be queried.
  • After a job is generated, it takes several seconds to query the job ID.
  • The following asynchronous tasks can be queried: creating an instance (single node, replica set, or cluster), scaling up storage, changing instance class, scaling up a node, restarting a node, performing a primary/standby switchover, changing a private IP address, changing a security group, changing a database port, binding or unbinding an EIP, switching the SSL mode, and changing an AZ, enabling the shard/config IP address, creating a physical backup/snapshot backup, restoration to a new instance using a backup, point-in-time recovery, and database/table-level restoration to a specified time point.

URI

  • URI format

    GET /v3/{project_id}/jobs?id={id}

  • URI example

    https://dds.ap-southeast-1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/jobs?id=a9767ede-fe0f-4888-9003-e843a4c90514

Requests

Parameter description

Table 1 Request parameters

Name

Type

IN

Mandatory

Description

x-auth-token

string

header

Yes

User token

project_id

string

path

Yes

The project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

id

string

query

Yes

The task ID.

Responses

  • Normal response
    Table 2 Parameter description

    Name

    Type

    Mandatory

    Description

    job

    Object

    Yes

    Task information. For details, see Table 3.

    Table 3 job field data structure description

    Name

    Type

    Mandatory

    Description

    id

    String

    Yes

    Task ID

    name

    String

    Yes

    Task name

    status

    String

    Yes

    Task execution status

    Valid value:
    • Running: The task is being executed.
    • Completed: The task is successfully executed.
    • Failed: The task fails to be executed.

    created

    String

    Yes

    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.

    ended

    String

    Yes

    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.

    progress

    String

    Yes

    Task execution progress

    NOTE:

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

    instance

    Object

    Yes

    Instance on which the task is executed.

    For details, see Table 4.

    fail_reason

    String

    Yes

    Task failure information.

    Table 4 instance field data structure description

    Name

    Type

    Mandatory

    Description

    id

    String

    Yes

    Instance ID

    name

    String

    Yes

    DB instance name

    In the response example, some tasks in the task center are used as examples.

  • Normal response example

    A task is successfully executed.

    {
      "job": {
        "id": "f85104b5-4a9c-4e0f-9505-fc5409d8f7ae",
        "name": "Create_MongoDB",
        "status": "Completed",
        "created": "2021-07-12T09:22:04+0000",
        "ended": "2021-07-12T10:10:13+0000",
        "progress": "",
        "instance": {
          "id": "d87f5b33049144ec95f0cab0a5f22cfbin02",
          "name": "dds-5ff4-sh"
        },
        "fail_reason": null
      }
    }

    A task is being executed:

    {
      "job": {
        "id": "9d10bfd1-affb-49c3-b977-298950a8d6fa",
        "name": "Create_MongoDB",
        "status": "Running",
        "created": "2021-07-13T07:28:43+0000",
        "ended": "2021-07-13T07:28:53+0000",
        "progress": "9%",
        "instance": {
          "id": "cf538a2dd8ec4b26860b27060902712fin02",
          "name": "dds-3a98-wcc"
        },
        "fail_reason": null
      }
    }

    A task fails to be executed:

    {
      "job": {
        "id": "a03b1b8a-b756-467c-8a49-38720c3d23ec",
        "name": "Restore_MongoDB_Replica",
        "status": "Failed",
        "created": "2021-07-13T04:55:58+0000",
        "ended": "2021-07-13T05:20:04+0000",
        "progress": "",
        "instance": {
          "id": "7beb15d5db9c4742b7c817789244844ein02",
          "name": "lenn-v3-restore-4"
        },
    "fail_reason": "Failed to upgrade the DB Agent."
      }
    }

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.