Restoring Databases and Tables to a Point in Time
Description
This API is used to restore databases and tables at a point in time.
Restrictions
This API applies only to replica sets.
URI
- URI format
POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/restore/collections
Name | Type | IN | Mandatory | Description |
---|---|---|---|---|
X-Auth-Token | string | header | Yes | User token |
X-Language | string | header | No | Language |
project_id | string | path | Yes | Project ID. To obtain the project ID, see Obtaining a Project ID. |
instance_id | string | path | Yes | Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one. |
Requests
- Parameter description
Table 2 Parameter description Name
Type
Mandatory
Description
restore_collections
Array of objects
Yes
The database information.
For details, see Table 3.
Table 3 restore_collections data structure description Name
Type
Mandatory
Description
database
String
Yes
Database name.
collections
Array of objects
No
The collection information.
For details, see Table 4.
restore_database_time
String
No
The database restoration time point.
This parameter is mandatory for database-level restoration,
The value is a UNIX timestamp, in milliseconds. The time zone is UTC.
Table 4 collections data structure description Name
Type
Mandatory
Description
old_name
String
Yes
The table name before the restoration.
new_name
String
No
The table name after the restoration.
restore_collection_time
String
Yes
The collection restoration time point.
The value is a UNIX timestamp, in milliseconds. The time zone is UTC.
- Request example
- Database-level restoration{"restore_collections": [{"database": "test","restore_database_time": 1607762955000}]}
- Collection-level restoration{"restore_collections": [{"database": "test","collections": [{"old_name": "test","restore_collection_time": 1607762955000}]}]}
- Database-level restoration
Responses
- Parameter description
Table 5 Parameter description Name
Type
Mandatory
Description
job_id
String
Yes
ID of the asynchronous task for the restore operation.
- Response example{"job_id": "a03b1b8a-b756-467c-8a49-38720c3d23ec"}
Status Code
For more information, see Status Code.
Error Code
For more information, see Error Code.
- Description
- Restrictions
- URI
- Requests
- Responses
- Status Code
- Error Code