Restore Database
const url = 'https://api.mengi.cloud/databases/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/restore';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"backup_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.mengi.cloud/databases/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/restore \ --header 'Content-Type: application/json' \ --data '{ "backup_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Overwrite the database’s current data with one of its backups, in place.
backup_id is a backup from GET /databases/{id}/backups that has
completed; the database returns to exactly the state that backup
captured. A target time cannot be given: point-in-time restore is not
available. The database keeps its name, host, user and password, so
connected applications only need to reconnect. Works for PostgreSQL and
MySQL databases that are not part of a replication group.
The restore runs in the background and the database shows the status
restoring meanwhile; it is unavailable for most of that time. It
first takes a safety backup of the current data (type pre_restore);
if that backup fails, nothing is overwritten and the database returns to
running with the reason in error_message. On success the database
returns to running; if the restore fails after the data was touched,
it goes to error.
Responds 202 with the database (status restoring), 400 when the backup
cannot be restored in place, 404 when the database or backup is not
found, and 409 when the database is not running or already restoring.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
A completed backup from GET /databases/{database_id}/backups. The database returns to exactly the state this backup captured; restoring to a point in time isn’t supported.
Example generated
{ "backup_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Responses
Section titled “Responses”Successful Response
object
Example
{ "engine": "postgresql", "tier": "single", "status": "pending", "external_access": false}Validation Error
object
object
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}