Up - API Reference - Home
Requires JWT.
Creates a backup of the project database. Use restore to go back to a backup.
Processing is done as a job running in the background, it may be incomplete when you receive the response. Job progress can be queried using the returned
job.token
.
POST /api/p/<project gid>/backups/create
Authorization: Bearer <JWT>
{
"created_by": "Update Catalog module (Unicat Connect)",
"name": "Update Catalog pre-upload backup"
}
created_by
specify the creator, useful for grouping backups
name
a name for the backup, defaults to 'Backup {version}' - you can't imitate this name
Authorization: <JWT>
{
"success": true,
"result": {
"project": "<project gid>",
"version": 3,
"last_backed_up": 1613565541.4195538,
"job.token": "06715cb7-4dfa-4ec1-bad4-c136ddbf80d9",
},
"data": {
"cc.projects": {
"<project gid>": {
…,
"backups": {
"versions": [
{
"version": 3,
"name": "Update Catalog pre-upload backup",
"created_by": "Update Catalog module (Unicat Connect)",
"timestamp": 1613565541.4195538
},
…
],
"next_version": 4
},
…
}
}
}
}
project
the current project.
version
the version assigned to the newly created backup.
last_backed_up
is a server-side timestamp for this backup.
job.token
the job token to look for in sync
events.
cc.projects
Project updated with new backup info. Note that this only becomes valid after the job completed successfully.
Look for the job.token
in sync events to find status updates on the operation. The sync event looks like this:
{
"type": "cc",
"cursor": <cursor>,
"action": "UPDATE",
"data_type": "jobs",
"data_key": "7c136ddb-4dfa-4ec1-bad4-15067cbf80d9",
"data": {
"project_gid": "<project_gid>",
"job": "backup_project",
"status": "processing",
"info": {
"total": 120,
"remaining": 26
},
"created_on": 1613565541.4195538,
"updated_on": 1613565543.2836412,
}
}
status
can be either queued
, rejected
, processing
, or done
.
When status
is done, the project data becomes valid.
401
Unauthorized - missing or expired JWT
403
Forbidden - not a member of this project
1003
Process error - Backup failed
HTTP/1.1 422 Unprocessable entity
{
"success": false,
"result": {
"code": 1003,
"message": "Process error",
"info": {
"process": "backup"
}
},
"data": {}
}