Updated on 2024-08-28 GMT+08:00

Obtaining Backups

Function

This API is used to obtain backups of a DB instance.

  • Before calling an API, you need to understand the API in Authentication.

Constraints

This API is used to query full and incremental backups of DB instances.

URI

  • URI format

    GET /v3/{project_id}/backups?instance_id={instance_id}&backup_id={backup_id}&backup_type={backup_type}&offset={offset}&limit={limit}&begin_time={begin _time}&end_time={end_time}

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Explanation:

    Project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    Constraints:

    N/A

    Value range:

    N/A

    Default value:

    N/A

    instance_id

    Yes

    Explanation:

    Instance ID.

    Constraints:

    N/A

    Value range:

    N/A

    Default value:

    N/A

    backup_id

    No

    Explanation:

    Backup ID.

    Constraints:

    N/A

    Value range:

    N/A

    Default value:

    N/A

    backup_type

    No

    Explanation:

    Backup type.

    Constraints:

    N/A

    Value range:

    • auto: automated full backup
    • manual: manual full backup
    • fragment: differential full backup
    • incremental: automated incremental backup

    Default value:

    N/A

    status

    No

    Explanation:

    Backup status. Only the statuses of RDS for SQL Server full backups can be filtered.

    Constraints:

    N/A

    Value range:

    • BUILDING: backup in progress
    • COMPLETED: backup completed
    • FAILED: backup failed

    Default value:

    N/A

    offset

    No

    Explanation:

    Index offset.

    Constraints:

    If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value must be a number but cannot be a negative number.

    Value range:

    An integer greater than or equal to 0

    Default value:

    0

    limit

    No

    Explanation:

    Number of records to be queried.

    Constraints:

    The value cannot be a negative number.

    Value range:

    1–100

    Default value:

    100

    begin_time

    No

    Explanation:

    Query start time.

    Constraints:

    When begin_time is not empty, end_time is mandatory.

    Value range:

    The value is 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.

    Default value:

    N/A

    end_time

    No

    Explanation:

    Query end time.

    Constraints:

    When end_time is not empty, begin_time is mandatory.

    Value range:

    The value is in the "yyyy-mm-ddThh:mm:ssZ" format and must be later than the query start time.

    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.

    Default value:

    N/A

Request

  • Request parameters

    None

  • URI example

    GET https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/backups?instance_id=43e4feaab48f11e89039fa163ebaa7e4in01&offset=0&limit=10&begin_time=2018-08-06T10:41:14+0800&end_time=2018-08-16T10:41:14+0800

Response

  • Normal response
    Table 2 Parameter description

    Name

    Type

    Description

    backups

    Array of objects

    Explanation:

    Indicates the backup list.

    For details, see Table 3.

    total_count

    Integer

    Explanation:

    Indicates the total number of records.

    Value range:

    N/A

    Table 3 backups field data structure description

    Name

    Type

    Description

    id

    String

    Explanation:

    Indicates the backup ID.

    Value range:

    N/A

    name

    String

    Explanation:

    Indicates the backup name.

    Value range:

    N/A

    type

    String

    Explanation:

    Indicates the backup type.

    Value range:

    • auto: automated full backup
    • manual: manual full backup
    • fragment: differential full backup
    • incremental: automated incremental backup

    size

    Long

    Explanation:

    Indicates the backup size in KB.

    Value range:

    N/A

    status

    String

    Explanation:

    Indicates the backup status.

    Value range:

    • BUILDING: backup in progress
    • COMPLETED: backup completed
    • FAILED: backup failed
    • DELETING: backup being deleted

    begin_time

    String

    Explanation:

    Indicates the backup start time.

    • For a full backup, it indicates the full backup start time.
    • For an RDS for MySQL incremental backup, it indicates the time when the last transaction of the last incremental backup task is committed.

    Value range:

    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.

    end_time

    String

    Explanation:

    Indicates the backup end time.

    • For a full backup, it indicates the full backup end time.
    • For an RDS for MySQL incremental backup, it indicates the time when the last transaction is committed.

    Value range:

    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.

    datastore

    Object

    Explanation:

    Indicates the database version.

    For details, see Table 4.

    databases

    Array of objects

    Explanation:

    Indicates a list of self-built Microsoft SQL Server databases that support partial backups.

    For details, see Table 5.

    instance_id

    String

    Explanation:

    Indicates the ID of the DB instance for which the backup is created.

    Value range:

    N/A

    associated_with_ddm

    Boolean

    Explanation:

    Indicates whether this instance is associated with a DDM instance.

    Value range:

    • false: The instance is not associated with any DDM instance.
    • true: The instance is associated with a DDM instance.
    Table 4 datastore field data structure description

    Parameter

    Type

    Description

    type

    String

    Explanation:

    Indicates the DB engine.

    Value range:

    The value is case-insensitive.

    • MySQL
    • PostgreSQL
    • SQLServer

    version

    String

    Explanation:

    Indicates the database version.

    Value range:

    N/A

    Table 5 databases field data structure description

    Parameter

    Type

    Description

    name

    String

    Explanation:

    Indicates the name of the self-built database.

    Value range:

    N/A

  • Example normal response

    Obtaining all backups of an RDS for MySQL instance:

    {
    	"backups": [{
    		"id": "43e4feaab48f11e89039fa163ebaa7e4br01",
    		"name": "xxxx.xxx",
    		"type": "auto",
    		"size": 2803,
    		"status": "COMPLETED",
    		"begin_time": "2018-08-06T12:41:14+0800",
    		"end_time": "2018-08-06T12:43:14+0800",
    		"datastore": {
    			"type": "MySQL",
    			"version": "5.7"
    		},
    		"instance_id": "a48e43ff268f4c0e879652d65e63d0fbin01",
    		"associated_with_ddm": false
    	}],
    	"total_count": 1
    }

    Obtaining all backups of an RDS for PostgreSQL instance:

    {
    	"backups": [{
    		"id": "43e4feaab48f11e89039fa163ebaa7e4br03",
    		"name": "xxxx.xxx",
    		"type": "incremental",
    		"size": 2803,
    		"status": "COMPLETED",
    		"begin_time": "2018-08-06T12:41:14+0800",
    		"end_time": "2018-08-06T12:43:14+0800",
    		"datastore": {
    			"type": "PostgreSQL",
    			"version": "1"
    		},
    		"instance_id": "a48e43ff268f4c0e879652d65e63d0fbin03 ",
    		"associated_with_ddm": false
    	}],
    	"total_count": 1
    }

    Obtaining all backups of an RDS for SQL Server instance:

    {
    	"backups": [{
    		"id ": "43e4feaab48f11e89039fa163ebaa7e4br04",
    		"name": "xxxx.xxx",
    		"type": "manual",
    		"size": 2803,
    		"status": "COMPLETED",
    		"begin_time": "2018-08-06T12:41:14+0800",
    		"end_time": "2018-08-06T12:43:14+0800",
    		"datastore": {
    			"type": "SQLServer",
    			"version": "2014_WEB"
    		},
    		"databases": [{
    			"name": "user01"
    		}, {
    			"name": "user02"
    		}],
    		"instance_id": "a48e43ff268f4c0e879652d65e63d0fbin04",
    		"associated_with_ddm": false
    	}],
    	"total_count": 1
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.