SearchStax API - Backup/Restore
Overview
SearchStax® provides an API supporting the creation, deletion and management of SearchStax deployments.
This page describes how to perform backup and restore operations through API methods.
The API can be accessed through any tool that assembles HTTP requests and dispatch them to a server. Among these would be the Python coreapi package, the Postman tool, and cURL. For Windows, use PowerShell Core 6.1+.
Account Owner, Admin, or Technical Contact
To run the SearchStax Provisioning API, you must be the account Owner, an account Admin, or a Technical Contact. See SearchStax User Roles.
Symbols enclosed in carets (< and >) such as <username> are metavariables. Substitute your local values when you encounter them in the examples.
Contents:
Related Pages:
- Authentication API
- Users API
- Basic Auth API
- IP Filtering API
- Deployment API
- DNS Alias API
- Tags API
- Alerts API
- Webhooks API
- Zookeeper API
Backup/Restore
The SearchStax Provisioning API includes methods for performing backup and restore operations.
account > deployment > backup > list
This method lists the existing backups of a deployment.
GET /api/rest/v2/account/<account_name>/deployment/<uid>/backup/
where <account_name> is the name of the tenant account, and <uid> is the ID of the deployment.
This method uses Token authentication.
There is no request body.
When invoked from Linux (Bash script):
curl --request GET "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/backup/" \
--header "Authorization: Token <token>"
When invoked from Windows (PowerShell script):
$ACCOUNT = "AccountName"
$uid = "ss123456"
$BACKUPS = Invoke-RestMethod -Method Get -ContentType 'application/json' -Headers $headers `
-uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/backup/"
$BACKUPS = $BACKUPS | ConvertTo-Json
A successful response contains a JSON object containing a list of backups:
[
{
"id": 26919,
"backup_type": "onetime",
"created": "2019-11-14T17:22:22Z",
"status": "done",
"size": 210553,
"region": "Amazon Web Services - us-west-1"
}
]
account > deployment > backup > create
This method makes a backup of a deployment.
POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/backup/
where <account_name> is the name of the tenant account, and <uid> is the ID of the deployment.
This method uses Token authentication.
The request body should be a "application/json" encoded object, containing the following items:
{
backup_type="onetime"
region="us-west-1"
}
Parameter | Description | Example |
---|---|---|
backup_type optional string |
Defaults to the literal string "onetime". | "onetime" |
region optional string |
The region ID of the region where the backup should be created. Defaults to the deployment's region. Region codes can be obtained using the List Plans method. | "eastus" |
When invoked from Linux (Bash script):
curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/backup/" \
--header "Content-Type: application/json" \
--header "Authorization: Token <token>" \
--data '{"backup_type":"onetime","region":"us-west-1"}'
When invoked from Windows (PowerShell script):
$ACCOUNT = "AccountName"
$uid = "ss123456"
$body = @{
backup_type='onetime'
region='us-west-1'
}
$body = $body | ConvertTo-Json
$RESULT = Invoke-RestMethod -Method Post -body $body -ContentType 'application/json' -Headers $headers `
-uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/backup/"
$RESULT = $RESULT | ConvertTo-Json
The response is a JSON document containing the description of the new backup.
{
"id": 26925,
"backup_type": "onetime",
"created": "2019-11-14T19:20:45.903037Z",
"status": "pending",
"size": 0,
"region": "Amazon Web Services - us-west-1"
}
account > deployment > backup > delete
This method deletes a backup from a deployment.
DELETE /api/rest/v2/account/<account_name>/deployment/<uid>/backup/<buid>/
where <account_name> is the name of the tenant account, <uid> is the ID of the deployment, and <buid> is the ID of the backup.
This method uses Token authentication.
There is no request body.
When invoked from Linux (Bash script):
curl --request DELETE "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/backup/<buid>/" \
--header "Authorization: Token <token>"
When invoked from Windows (PowerShell script):
$ACCOUNT = "AccountName"
$uid = "ss123456"
$BUID = "27004"
$BACKUPS = Invoke-RestMethod -Method Delete -ContentType 'application/json' -Headers $headers `
-uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/backup/$BUID/"
$BACKUPS = $BACKUPS | ConvertTo-Json
A successful response is a JSON document containing a confirmation message:
{
"message": "Successfully deleted backup 27004",
"success": "true"
}
account > deployment > restore > create
This method restores a backup to a deployment.
POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/restore/
where <account_name> is the name of the tenant account, and <uid> is the ID of the deployment.
This method uses Token authentication.
The request body should be a "application/json" encoded object, containing the following items:
{
backup_id="27004"
replication_factor="3"
}
Parameter | Description | Example |
---|---|---|
backup_id required string |
The backup id number, from the List Backups method. | "27004" |
replication_factor optional string |
Defaults to the number of nodes in the target cluster. You may ask for fewer replicas, but not for more. | "2" |
When invoked from Linux (Bash script):
curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/restore/" \
--header "Content-Type: application/json" \
--header "Authorization: Token <token>" \
--data '{"backup_id":"27004","replication_factor":"3"}'
When invoked from Windows (PowerShell script):
$ACCOUNT = "AccountName"
$uid = "ss123456"
$body = @{
backup_id='27004'
replication_factor='3'
}
$body = $body | ConvertTo-Json
$RESULT = Invoke-RestMethod -Method Post -body $body -ContentType 'application/json' -Headers $headers `
-uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/restore/"
$RESULT = $RESULT | ConvertTo-Json
The response is a JSON document confirming that the restore has been scheduled.
{
"message": "The restore request has been successfully placed in the Task queue and will be initiated soon. You can check the status with the restore-status API"
}
account > deployment > restore > status
This method reports on the status of a restore.
POST /api/rest/v2/account/<account_name>/deployment/<uid>/restore/status/
where <account_name> is the name of the tenant account, <uid> is the ID of the deployment.
This method uses Token authentication.
There is no request body.
When invoked from Linux (Bash script):
curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/restore/status/" \
--header "Authorization: Token <token>"
When invoked from Windows (PowerShell script):
$ACCOUNT = "AccountName"
$uid = "ss123456"
$RESULTS = Invoke-RestMethod -Method Post -ContentType 'application/json' -Headers $headers `
-uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/restore/status/"
$RESULTS = $RESULTS | ConvertTo-Json
The response is a JSON object containing an appropriate message string:
{
"message": "Backup Restore in Progress"
}
{
"message": "No restore Running on this deployment"
}
Questions?
Do not hesitate to contact the SearchStax Support Desk.