Restoring Databases and Tables to a Point in Time¶
Function¶
This API is used to restore databases and tables at a point in time.
Constraints¶
This API applies only to replica sets.
URI¶
URI format
POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/restore/collections
Parameter description
¶ Name
Mandatory
Description
project_id
Yes
Specifies the project ID of a tenant in a region.
instance_id
Yes
Specifies the instance ID, which can be obtained by calling the API for querying instances. If you do not have an instance, you can call the API used for creating an instance.
Requests¶
Parameter description
¶ Name
Mandatory
Type
Description
restore_collections
Yes
Array of objects
Specifies the database information.
For details, see Table 3.
¶ Name
Mandatory
Type
Description
database
Yes
String
Specifies the database name.
collections
No
Array of objects
Specifies the collection information.
For details, see Table 4.
restore_database_time
No
String
Specifies 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.
¶ Name
Mandatory
Type
Description
old_name
Yes
String
Specifies the original table name before the restoration.
new_name
No
String
Specifies the table name after the restoration.
restore_collection_time
Yes
String
Specifies 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 } ] } ] }
Responses¶
Parameter description
¶ Name
Type
Description
job_id
String
ID of the asynchronous task for the restore operation.
Response example
{ "job_id": "a03b1b8a-b756-467c-8a49-38720c3d23ec" }
Abnormal Response
For details, see Abnormal Request Results.
Status Code¶
Status Code:200.
For more information, see Status Code.
Error Code¶
For more information, see Error Code.