Ploi API
Ploi API

Update site file backup

Update site file backup

PATCH api/backups/file/{id}

Parameters

Parameter Type Status Description
interval integer required Must be either of these values: 0, 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
path string required The path on the server to backup (must start with /home/{system_user}/{root_domain})
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
local_path string optional For local driver, the destination path where the backup should be stored (must start with /)
compression string optional The compression type to use for the backup (e.g., zip, gzip)
excluded array optional An array of directories or files you do not want to include in the backup (e.g., node_modules, vendor)
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/file/1" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
   --data '{
     "interval": 720,
     "keep_backup_amount": 5,
     "path": "/home/ploi/example.com/public",
     "deleteOnFail": false,
     "custom_name": "site-backup.zip",
     "local_path": "/backups/sites",
     "compression": "zip",
     "excluded": ["node_modules", "vendor", ".git"],
     "locations": "production-sites"
}'

Example response:

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

{
    "data": {
        "id": 1,
        "type": "local",
        "path": "/home/ploi/example.com/public",
        "local_path": "/backups/sites",
        "compression": "zip",
        "interval": 720,
        "keep_backup_amount": 5,
        "custom_name": "site-backup.zip",
        "delete_on_fail": false,
        "excluded": ["node_modules", "vendor", ".git"],
        "locations": "production-sites",
        "status": "active",
        "last_backup_at": null,
        "next_backup_at": "2025-01-15T12:00:00.000000Z",
        "created_at": "2025-01-14T10:30:00.000000Z",
        "site": {
            "id": 1,
            "root_domain": "example.com",
            "server_id": 1,
            "server": {
                "id": 1,
                "name": "Production Server",
                "status_id": 1,
                "ip": "192.168.1.1"
            }
        },
        "backup_configuration": {
            "id": 1,
            "label": "Local Backups",
            "type": "local"
        }
    }
}