• Relational Database Service

rds
  1. Help Center
  2. Relational Database Service
  3. API Reference
  4. API v3 (Recommended)
  5. Obtaining Information About a Specified Task

Obtaining Information About a Specified Task

Function

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

URI

  • URI format

    PATH: /{version_id}/{project_id}/jobs?id={id}

    Method: GET

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    version_id

    Yes

    Specifies the API version. It is case-sensitive and the value is v3.

    project_id

    Yes

    Specifies the project ID of a tenant in a region.

  • Restrictions
    • This API is used to query only asynchronous tasks in the task center within one month.
    • Currently, the following asynchronous tasks can be queried: creating single or primary/standby MySQL, PostgreSQL, or Microsoft SQL Server DB instances and creating MySQL or PostgreSQL read replicas.

Request

  • Parameter description
    Table 2 Parameter description

    Name

    Mandatory

    Type

    Description

    id

    Yes

    String

    Specifies the task ID.

  • Request example
    GET /v3/0483b6b16e954cb88930a360d2c4e663/jobs?id=a9767ede-fe0f-4888-9003-e843a4c90514

Normal Response

  • Parameter description
    Table 3 Parameter description

    Name

    Type

    Description

    id

    String

    Indicates the task ID.

    name

    String

    Indicates the task name.

    status

    String

    Indicates the task execution status.

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

    created

    String

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

    process

    String

    Indicates the task execution progress.

    NOTE:

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

    instance

    Dictionary data structure

    Indicates information of the DB instance on which the task is executed.

    For details, see Table 4.

    entities

    Dictionary data structure

    The displayed information varies depending on the tasks.

    Refer to the following:

    NOTE:

    For asynchronous tasks without the entities field description, {} is returned.

    fail_reason

    String

    Indicates the error information displayed when a task failed.

    Table 4 instances field data structure description

    Name

    Type

    Description

    id

    String

    Indicates the DB instance ID.

    name

    String

    Indicates the DB instance name.

    Table 5 entities field data structure description (creating DB instances, changing single DB instances to primary/standby, or creating read replicas)

    Name

    Type

    Description

    instance

    Dictionary data structure

    Indicates the DB instance information to be implemented by a task.

    For details, see Table 6.

    resource_ids

    List<String>

    Indicates the resource ID involved in a task.

    Table 6 entities.instance field data structure description

    Name

    Type

    Description

    endpoint

    String

    Indicates the DB instance connection address.

    type

    String

    The value is Single, Ha, or Replica, indicating the single DB instance, primary/standby DB instances, and read replica, respectively.

    datastore

    Dictionary data structure

    Data structure. For details, see Table 7.

    replica_of

    String

    Indicates the primary DB instance ID. This parameter is returned only when a read replica is created.

    Table 7 datastore field data structure description

    Name

    Type

    Description

    type

    String

    Indicates the DB engine.

    version

    String

    Indicates the database version.

    Table 8 entities field data structure description (resizing a DB instance)

    Name

    Type

    Description

    volume

    Dictionary data structure

    Indicates the resized disk information.

    For details, see Table 9.

    resource_ids

    List<String>

    Indicates the resource ID involved in a task.

    Table 9 volume field data structure description

    Name

    Type

    Description

    type

    String

    Indicates the volume type.

    original_size

    String

    Indicates the original disk size of the DB instance.

    target_size

    String

    Indicates the target disk size of the DB instance.

    Table 10 entities field data structure description (binding/unbinding EIPs or enabling/disabling remote access)

    Name

    Type

    Description

    public_ip

    String

    Indicates the EIP implemented by the task.

    Table 11 entities field data structure description (primary/standby switchover)

    Name

    Type

    Description

    switch_strategy

    String

    Indicates the primary/standby switchover policy.

    NOTE:

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

  • Response example
    Creating a DB instance:
    {
    	"job": {
    		"id": "31b8ae23-c687-4d80-b7b4-42a66c9bb886",
    		"name": "CreateMysqlSingleHAInstance",
    		"status": "Completed",
    		"created": "2018-08-06T10:41:14+0800",
    		"process": "",
    		"instance": {
    			"id": "a48e43ff268f4c0e879652d65e63d0fbin01",
    			"name": "DO-NOT-TOUCH-mgr2-mysql-single"
    		},
    		"entities": {
    			"instance": {
    				"endpoint": "192.168 .1 .203: 3306",
    				"type": "Single",
    				"datastore": {
    					"type": "mysql",
    					"version": "5.7"
    				}
    			},
    			"resource_id": ["a48e43ff268f4c0e879652d65e63d0fbin01.vm", "a48e43ff268f4c0e879652d65e63d0fbin01.volume"]
    		}
    	}
    }
    Creating a read replica:
    {
    	"job": {
    		"id": "31b8ae23-c687-4d80-b7b4-42a66c9bb886",
    		"name": " CreateMysqlReplicaInstance",
    		"status": "Completed",
    		"created": "2018-08-06T10:41:14+0800",
    		"process": "",
    		"instance": {
    			"id": "288caaa9d05f4ec1a1f58de2e0945685in01",
    			"name": "mysql-replica"
    		},
    		"entities": {
    			"instance": {
    				"endpoint": "192.168 .1 .203: 3306",
    				"type": "replica",
    				"datastore": {
    					"type": "mysql",
    					"version": "5.7"
    				},
    				"replica_of": "a48e43ff268f4c0e879652d65e63d0fbin01"
    			},
    			"resource_ids": ["288caaa9d05f4ec1a1f58de2e0945685in01.vm", "288caaa9d05f4ec1a1f58de2e0945685in01.volume"]
    		}
    	}
    }
    Binding an EIP:
    {
    	"job": {
    		"id": "31b8ae23-c687-4d80-b7b4-42a66c9bb886",
    		"name": "MysqlBindEIP",
    		"status": "Completed",
    		"created": "2018-08-06T10:41:14+0800",
    		"process": "",
    		"instance": {
    			"id": "a48e43ff268f4c0e879652d65e63d0fbin01",
    			"name": "DO-NOT-TOUCH-mgr2-mysql-single"
    		},
    		"entities": {
    			"public_ip": "10.154 .218 .254"
    		}
    	}
    }
    Rebooting a DB instance:
    {
    	"job": {
    		"id": "31b8ae23-c687-4d80-b7b4-42a66c9bb886",
    		"name": " RestartMysqlInstance",
    		"status": "Completed",
    		"created": "2018-08-06T10:41:14+0800",
    		"process": "",
    		"instance": {
    			"id": "a48e43ff268f4c0e879652d65e63d0fbin01",
    			"name": "DO-NOT-TOUCH-mgr2-mysql-single"
    		},
    		"entities": {}
    	}
    }
    Task being executed:
    {
    	"job": {
    		"id": "31 b8ae23 - c687 - 4 d80 - b7b4 - 42 a66c9bb886",
    		"name": "CreateMysqlSingleHAInstance"," status": "Running",
    		"created": "2018-08-06T10:41:14+0800",
    		"process": "60 % ",
    		"instance": {
    			"id": "a48e43ff268f4c0e879652d65e63d0fbin01",
    			"name": "DO-NOT-TOUCH-mgr2-mysql-single"
    		},
    		"entities": {
    			"instance": {
    				"type": "Single",
    				"datastore": {
    					"type": "mysql",
    					"version": "5.7"
    				}
    			}
    		}
    	}
    }
    Task fails to be executed:
    {
    	"job": {
    		"id": "31 b8ae23 - c687 - 4 d80 - b7b4 - 42 a66c9bb886",
    		"name": "CreateMysqlSingleHAInstance",
    		"status": "Failed",
    		"created": "2018-08-06T10:41:14+0800",
    		"process": "",
    		"instance": {
    			"id": "a48e43ff268f4c0e879652d65e63d0fbin01",
    			"name": "DO-NOT-TOUCH-mgr2-mysql-single"
    		},
    		"entities": {
    			"instance": {
    				"type": "Single",
    				"datastore": {
    					"type": "mysql",
    					"version": "5.7"
    				}
    			}
    		},
    		"fail_reason": "createVM failed."
    	}
    }

Abnormal Response

For details, see Abnormal Request Results.