How to manage server backups via API
Before using the API to manage your Server Backups, please ensure you meet the requirements for authentication described in the prerequisites below.
Prerequisites
Section titled “Prerequisites”- You have created a Service Account.
(See: Create a Service Account) - You have assigned the required project permissions to this Service Account.
(See: Assign permissions to a Service Account) - You have created an Access Token for this Service Account.
(See: Assign authentication token to a Service Account)
Activate the Server Backup Management Service
Section titled “Activate the Server Backup Management Service”To activate the Server Backup Management Service for a new server, send a request as shown below, including the portalProjectId, region and serverId in the URL.
POST https://server-backup.api.stackit.cloud/v2/projects/{portalProjectId}/regions/{region}/servers/{serverId}/serviceActivate the Server Backup Management Service with default backup schedule
Section titled “Activate the Server Backup Management Service with default backup schedule”If you want to activate the Server Backup Management Service for a new server with the default backup schedule already included, first send the following request, including the portalProjectId and region in the URL to fetch the proper backup policy ID:
GET https://server-backup.api.stackit.cloud/v2/projects/{portalProjectId}/regions/{region}/backup-policiesAfterwards send a request to activate the Server Backup Management Service and include the portalProjectId, region, serverId and backupPolicyId in the request body:
POST https://server-backup.api.stackit.cloud/v2/projects/{portalProjectId}/regions/{region}/servers/{serverId}/service
{ "backupPolicyId": "2ab33ea4-9b4b-492c-8679-3d664091c195"}This will enable the backup schedule with a 14-day retention period for all volumes of this server.
Create a backup schedule
Section titled “Create a backup schedule”When you are creating backup schedules, you have to provide recurrence rules for calendar dates in the rrule field according to the Internet Calendaring and Scheduling Core Object Specification (iCalendar SRFC5545 ).
Please find below an example of the request which needs to be sent with provided portalProjectId, region, serverId and rrule:
POST https://server-backup.api.stackit.cloud/v2/projects/{portalProjectId}/regions/{region}/servers/{serverId}/backup-schedules
{ "backupProperties": { "name": "Daily Backup", "retentionPeriod": 3, "volumeIds": [ "58335311-6acf-46c5-8652-cb96cd63181e", "38345f49-047b-437d-83a1-458f04fa3182" ] }, "enabled": true, "name": "Daily Schedule", "rrule": "DTSTART;TZID=Europe/Sofia:20200803T023000 RRULE:FREQ=DAILY;INTERVAL=1"}Also visit the full Server Backup Management API documentation , including all available endpoints and examples.