Other Backup API Examples
Authentication
Go to the MariaDB Cloud API Key management page and generate an API key. Export the value from the token field to an environment variable $API_KEYexport API_KEY='... key data ...'
Use it on subsequent request, e.g: bash curl --request
GET 'https://api.skysql.com/skybackup/v1/backups/schedules' \
--header "X-API-Key: ${API_KEY}"
Working With Backup Schedules
Getting Backup Schedules Inside the Organization
curl --location '<https://api.skysql.com/skybackup/v1/backups/schedules>' \
--header 'Accept: application/json' \
--header 'X-API-Key: ${API_KEY}'
API_KEY : SKYSQL API KEY, see MariaDB Cloud API Keys
Getting all Backup Schedules per Service
To get backup schedules for specific service :
curl --location '<https://api.skysql.com/skybackup/v1/backups/schedules?service_id=dbtgf28044362>' \
--header 'Accept: application/json' \
--header 'X-API-Key: ${API_KEY}'
API_KEY : SKYSQL API KEY, see MariaDB Cloud API Keys
Getting Backup Schedules by ID
To get specific backup schedule by id :
curl --location 'https://api.skysql.com/skybackup/v1/backups/schedules/200' \
--header 'Accept: application/json' \
--header 'X-API-Key: ${API_KEY}'
API_KEY : SKYSQL API KEY, see MariaDB Cloud API Keys
Updating Backup Schedules
In the following example, we update the backup schedule to 9 AM UTC. Remember, you cannot change the schedules for one-time backups. To update specific backup schedule you need to make the following API call:
curl --location --request PATCH '<https://api.skysql.com/skybackup/v1/backups/schedules/215>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-API-Key: ${API_KEY}' \
--data '{
"schedule": "0 9 ** *"
}'
API_KEY : SKYSQL API KEY, see MariaDB Cloud API Keys
SCHEDULE : Cron schedule, see Cron
Deleting Backup Schedules
To delete a backup schedule you need to provide the backup schedule id. Example of the api call below:
curl --location --request DELETE 'https://api.skysql.com/skybackup/v1/backups/schedules/215' \
--header 'Accept: application/json' \
--header 'X-API-Key: ${API_KEY}'
API_KEY : SKYSQL API KEY, see MariaDB Cloud API Keys
Backup Status
The following API illustrates how to get the available backups and status of backup jobs .
Listing all Backups Inside the Organization
Here is an example to fetch all the available Backups in your org:
curl --location 'https://api.skysql.com/skybackup/v1/backups' \
--header 'Accept: application/json' \
--header 'X-API-Key: ${API_KEY}'
API_KEY : SKYSQL API KEY, see MariaDB Cloud API Keys
Listing all Backups by Service
To list all backups available for your service :
curl --location 'https://api.skysql.com/skybackup/v1/backups?service_id=dbtgf28216706' \
--header 'Accept: application/json' \
--header 'X-API-Key: ${API_KEY}'
API_KEY : SKYSQL API KEY, see MariaDB Cloud API Keys
The typical response of either of two calls should look like:
{
"backups": [
{
"id": "eda3b72460c8c0d9d61a7f01b6a22e32:dbtgf28216706:tx-filip-mdb-ms-0",
"service_id": "dbtgf28216706",
"type": "full",
"method": "skybucket",
"server_pod": "tx-filip-mdb-ms-0",
"backup_size": 5327326,
"reference_full_backup": "",
"point_in_time": "2024-03-26 17:18:21",
"start_time": "2024-03-26T17:18:57Z",
"end_time": "2024-03-26T17:19:01Z",
"status": "Succeeded"
}
],
"backups_count": 1,
"pages_count": 1
}
The Backup id is the most important part of this data as you need to provide it in the restore api call to schedule restore execution.
Last updated
Was this helpful?