Skip to content

02. REST API

Kaan Tolunay Kilic edited this page Dec 14, 2020 · 1 revision

The provided Penelope API can handle both POST, PATCH and GET requests. They are used for different methods, though. When creating new backups you have to use POST and include all backup specifications. Depending on what action you want to carry out, you can make use of the following API request types:

Users

Get user

Returns all project role bindings of the currently logged in user.

POST /api/users/me

Backups

Create backup

The create request allows you to create a backup, either a one shot or repeating backup sequences.

POST /api/backups
Name Required Description
type required The type of backup which should be created BigQuery or CloudStorage.
strategy required The strategy for the backup which can be Snapshot or Mirror.
project required The GCP project for which a backup should be created.
target required Options for target backup.
snapshot_options optional Options for a Snapshot backup.
mirror_options optional Options for a Mirror backup.
bigquery_options optional Specified options when type of backup is BigQuery.
gcs_options optional Specified options when type of backup is CloudStorage.

List backup

The GET request allows you to get all backups from one GCP project.

GET /api/backups
Name Required Description
project required The GCP project of the backups.

Get single backup

Returns a single backup, specified by the id parameter.

GET /api/backups/:id
Name Required Description
id required The ID of the desired backup.

Update single backup

Updates a single backup, specified by the id parameter.

PATCH /api/backups/:id
Name Required Description
id required The ID of the desired backup.

Calculates cost of single backup

Calculates the cost of a single backup, specified by the parameters.

POST /api/backups/calculate
Name Required Description
type required The type of backup which should be created BigQuery or CloudStorage.
strategy required The strategy for the backup which can be Snapshot or Mirror.
project required The GCP project for which a backup should be created.
target required Options for target backup.
snapshot_options optional Options for a Snapshot backup.
mirror_options optional Options for a Mirror backup.
bigquery_options optional Specified options when type of backup is BigQuery.
gcs_options optional Specified options when type of backup is CloudStorage.

Buckets & Datasets

List cloud storage buckets

Lists all google cloud storage buckets from a GCP project, specified by the id parameter.

GET /api/buckets/:id
Name Required Description
id required The ID of the desired GCP project.

List big query datasets

Lists all big query datasets from a GCP project, specified by the id parameter.

GET /api/datasets/:id
Name Required Description
id required The ID of the desired GCP project.

Restore

List restore actions

Lists restore actions for a backup. An addition, all previous jobs including the specified job can be chosen.

GET /api/restore/:id
Name Required Description
jobIDForTimestamp optional When specified, it returns the restore action for the specified and all previous jobs.

Tasks

These are special api endpoint for triggering backup tasks. You may want to set up cron jobs to trigger these tasks regularly and automatically.

Prepare all backup jobs

GET /api/tasks/prepare_backup_jobs

Run new jobs

GET /api/tasks/run_new_jobs

Check all job status

GET /api/tasks/check_jobs_status

Check stuck jobs

GET /api/tasks/check_jobs_stuck

Clean up expired backup sinks

GET /api/tasks/cleanup_expired_sinks