Updated on 2023-11-24 GMT+08:00

Querying Tasks and Details

API Description

This API is used to query tasks and details in the task center based on specified conditions.

Restrictions

  • Currently, only asynchronous tasks in the task center of DDS Community Edition within one month can be queried.

URI

  • URI format

    GET https://{Endpoint}/v3.1/{project_id}/jobs

  • URI example

    https://dds.ap-southeast-1.myhuaweicloud.com/v3.1/0549b4a43100d4f32f51c01c2fe4acdb/jobs

Table 1 Request parameters

Name

Type

IN

Mandatory

Description

X-Auth-Token

string

header

Yes

User token obtained from IAM. For details, see Authentication.

project_id

string

path

Yes

Project ID of a tenant in a region. Obtain the project ID by following the instructions in Obtaining a Project ID.

Table 2 Query parameters

Name

Mandatory

Type

Description

start_time

Yes

String

The start time. The format of the start time is "yyyy-mm-ddThh:mm:ssZ".

T is the separator between calendar and hourly notation of time. Z indicates the time zone offset.

end_time

Yes

String

The end time. The format of the end time is "yyyy-mm-ddThh:mm:ssZ" and the end time must be later than the start time. The time span cannot be longer than 30 days.

T is the separator between calendar and hourly notation of time. Z indicates the time zone offset.

status

No

String

Task status. Running indicates that the task is being executed. Completed indicates that the task is completed. Failed indicates that the task fails.

id

No

String

Task ID.

name

No

String

Task name. The value can be:

  • CreateMongoDB: Create a cluster instance.
  • CreateMongoDBReplica: Create a replica set instance.
  • CreateMongoDBReplicaSingle: Create a single node instance.
  • EnlargeMongoDBVolume: Scale up the storage capacity of a DB instance.
  • ResizeMongoDBInstance: Change the class of a DB instance of Community Edition.
  • ResizeDfvMongoDBInstance: Change the class of a DB instance of Enhanced Edition.
  • EnlargeMongoDBGroup: Add a node.
  • ReplicaSetEnlargeNode: Add a standby node to a replica set instance.
  • AddReadonlyNode: Add a read replica.
  • RestartInstance: Restart a cluster instance.
  • RestartGroup: Restart a cluster node group.
  • RestartNode: Restart a cluster node.
  • RestartReplicaSetInstance: Restart a replica set instance.
  • RestartReplicaSingleInstance: Restart a single node instance.
  • SwitchPrimary: Perform a primary/standby switchover.
  • ModifyIp: Change the private IP address.
  • ModifySecurityGroup: Modify a security group.
  • ModifyPort: Change the database port.
  • BindPublicIP: Bind an EIP.
  • UnbindPublicIP: Unbind an EIP.
  • SwitchInstanceSSL: Switch the SSL.
  • AzMigrate: Migrate a DB instance from one AZ to another.
  • CreateIp: Enable the shard/config IP address.
  • ModifyOpLogSize: Change the oplog size.
  • RestoreMongoDB: Restore a cluster instance to a new DB instance.
  • RestoreMongoDB_Replica: Restore a replica set instance to a new DB instance.
  • RestoreMongoDB_Replica_Single: Restore a single node instance to a new DB instance.
  • RestoreMongoDB_Replica_PITR: Restore a replica set instance to a specified point in time.
  • MongodbSnapshotBackup: Create a physical backup.
  • MongodbSnapshotEBackup: Create a snapshot backup.
  • MongodbRestoreData2CurrentInstance: Restore a backup to the original DB instance.
  • MongodbRestoreData2NewInstance: Restore a backup to a new DB instance.
  • MongodbPitr2CurrentInstance: Restore a backup to a specified time point of the original DB instance.
  • MongodbPitr2NewInstance: Restore a backup to a specified time point of a new DB instance.
  • MongodbRecycleBackup: Restore a backup from the recycle bin.
  • MongodbRestoreTable: Restore databases and tables to a specified point in time.
  • UpgradeDatabaseVersion: Upgrade the database patch.

offset

No

Integer

Index offset. If offset is set to N, the resource query starts from the N+1 piece of data. The default value is 0, indicating that the query starts from the first piece of data. The value must be a positive integer.

limit

No

Integer

Number of records to be queried. The default value is 100. The value must be a positive integer. The minimum value is 1 and the maximum value is 100.

Requests

None

Responses

  • Parameter description
    Table 3 Response body parameters

    Name

    Type

    Description

    jobs

    Array of Table 5-5 objects

    Task list.

    total_count

    Integer

    Total number of tasks in the task list.

    Table 4 job

    Name

    Type

    Description

    id

    String

    Task ID.

    name

    String

    Task name.

    instance_id

    String

    DB instance ID.

    instance_name

    String

    DB instance name.

    status

    String

    Task status. Running indicates that the task is being executed. Completed indicates that the task is completed. Failed indicates that the task fails.

    progress

    String

    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. Task execution progress.

    fail_reason

    String

    Task failure information.

    created_at

    String

    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, in the Beijing time zone, the time zone offset is shown as +0800.

    ended_at

    String

    End 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, in the Beijing time zone, the time zone offset is shown as +0800.

  • Example response
    {
        "jobs": [
            {
                "id": "2f406db7-bdc4-402f-9dc4-2c1b094a5f93",
                "name": "RestartReplicaSetInstance",
                "status": "Completed",
                "created_at": "2022-09-05T06:24:14+0000",
                "ended_at": "2022-09-05T06:25:43+0000",
                "progress": "",
                "instance_id": "1f311e6a299345d7bbc878874844e233in02",
                "instance_name": "dds-6be2-fwyrestore",
                "fail_reason": ""
            }
        ]
    }

SDK

Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.