Ploi API
Ploi API

Update database backup

Updates a database backup resource

PATCH api/backups/database/{id}

Parameters

Parameter Type Status Description
interval integer required Must be either of these values: 0, 10, 20, 30, 40, 50, 60, 120, 240, 480, 720, 1440, 10080, 43800 (0 = nightly, the rest is each minute)
keep_backup_amount integer required This is used to determine how many backups should be saved
deleteOnFail boolean optional Whether to delete the backup file if the backup process fails
custom_name string optional This is used to define a custom archive name
path string optional This is used for storage drivers to determine which path the backup should be put in (required for aws-s3, digitalocean-spaces, custom-s3, sftp, ftp, local drivers)
compression string optional The compression type to use for the backup (e.g., zip, gzip)
excluded array optional An array of table names you do not want to include in the backup
locations string optional This is only used for google-drive driver to determine which folder backups should be put in

Example request:

curl -X PATCH "https://ploi.io/api/backups/database/1" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
   --data '{
     "interval": 120,
     "keep_backup_amount": 10,
     "deleteOnFail": true,
     "custom_name": "my-backup.zip",
     "path": "/backups",
     "compression": "gzip",
     "excluded": ["sessions", "cache"],
     "locations": "production-backups"
}'

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": 1,
        "type": "local",
        "path": "/backups",
        "compression": "gzip",
        "interval": 120,
        "keep_backup_amount": 10,
        "custom_name": "my-backup.zip",
        "delete_on_fail": true,
        "excluded": ["sessions", "cache"],
        "locations": "production-backups",
        "status": "active",
        "last_backup_at": null,
        "next_backup_at": "2025-01-15T12:00:00.000000Z",
        "created_at": "2025-01-14T10:30:00.000000Z",
        "server": {
            "id": 1,
            "name": "Production Server",
            "status_id": 1,
            "ip": "192.168.1.1",
            "tags": ["production"]
        },
        "database": {
            "id": 1,
            "name": "my_database",
            "status_id": 1
        },
        "backup_configuration": {
            "id": 1,
            "label": "Local Backups",
            "type": "local"
        }
    }
}