Restore a backup
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.wpengineapi.com/v1/installs/294deacc-d8b8-4005-82c4-0727ba8ddde0/backups/e41fa98f-ea80-4654-b229-a9b765d0863a/restore"
payload := strings.NewReader("{ \"notification_emails\": [ \"myself@torquemag.com\" ], \"restore_database\": true, \"create_checkpoint\": true }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <credentials>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.wpengineapi.com/v1/installs/294deacc-d8b8-4005-82c4-0727ba8ddde0/backups/e41fa98f-ea80-4654-b229-a9b765d0863a/restore';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"notification_emails":["myself@torquemag.com"],"restore_database":true,"create_checkpoint":true}'};
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.wpengineapi.com/v1/installs/294deacc-d8b8-4005-82c4-0727ba8ddde0/backups/e41fa98f-ea80-4654-b229-a9b765d0863a/restore \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "notification_emails": [ "myself@torquemag.com" ], "restore_database": true, "create_checkpoint": true }'Restores the install to the state captured in the specified backup.
Limitations & Warnings
- Asynchronous: the restore is started, not finished, when the response is
returned. The addresses in
notification_emailsreceive an email once it has completed. - By default the database is restored and a checkpoint is created first. Set
restore_databaseorcreate_checkpointtofalseto change this.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”ID of install
Example
294deacc-d8b8-4005-82c4-0727ba8ddde0ID of backup to restore from
Example
e41fa98f-ea80-4654-b229-a9b765d0863aRequest Bodyrequired
Section titled “Request Bodyrequired”Properties
- notification_emails - required - The email address(es) that will receive an email once the restore has completed.
- restore_database - optional (default: true) - Whether to restore the database from the backup.
- create_checkpoint - optional (default: true) - Whether to create a checkpoint before restoring.
object
The email address(es) that will receive an email once the restore has completed.
Whether to restore the database from the backup.
Whether to create a checkpoint before restoring.
Example
{ "notification_emails": [ "myself@torquemag.com" ], "restore_database": true, "create_checkpoint": true}Responses
Section titled “Responses”Accepted. The restore has been initiated; the addresses in notification_emails are notified when it completes.
Bad Request
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
An array of error objects describing specific errors that arose when servicing the request
object
The name of the resource that was being processed when the error occurred
(Optional) The specific field associated with the error
(Optional) A type associated with the error. invalid_value, access_error, value_unavailable
(Optional) A machine code relating to the error that occurred with the field and resource
(Optional) A human-readable message relating to the error that occurred with the field and resource
Example
{ "message": "Invalid request.", "errors": [ { "resource": "Resource", "field": "field_name", "type": "invalid_value", "code": "invalid", "message": "The value is invalid." } ]}Authentication Error
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
Example
{ "message": "Bad Credentials"}Not authorized
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
Example
{ "message": "You don't have permission to perform that action"}Not found
object
A message regarding the error that occurred on the server
(Optional) A URL where documentation regarding this specific error can be found
Example
{ "message": "Not Found"}Too many requests
Internal Server Error
object
A message regarding the error that occurred on the server
Example
{ "message": "An unexpected error occurred, please try again in a few minutes"}An invalid response was received from an upstream server
Service unavailable