Perform an Immediate Backup

    +
    The Backup Service REST API allows an immediate backup to be triggered.

    HTTP Method and URI

    POST /cluster/self/repository/active/<repository-id>/backup

    Description

    Triggers an immediate backup for the specified active repository: thus, the need to wait for a scheduled backup can be eliminated as required.

    Curl Syntax

    curl -X POST http://<backup-node-ip-address-or-domain-name>:8097/cluster/self\
    /repository/active/<repository-id>/backup \
      -u <username>:<password>

    The username and password must identify an administrator with the Full Admin role. The repository-id must be the name of an active repository on the cluster.

    Responses

    Successful execution triggers the specified backup, and returns 200 OK, with an object that provides the task id. For example:

    {"task_name":"BACKUP-b19a0d39-2a41-49e0-bc0c-db0cb42bcb12"}

    If the specified repository cannot be located, 404 Object Not Found is returned, with an object such as the following: {"status":404,"msg":"repository `res4tRepo does not exist"}`.

    If the call is improperly formatted, 400 Bad Request is returned; with an object such as the following: {"status":400,"msg":"invalid request body","extras":"invalid character '{' looking for beginning of object key string"}.

    If an internal error prevents successful execution, 500 Internal Server Error is returned; with a message such as the following: {"status":500,"msg":"could not send task","extras":"failed bucket check for bucket 'travel-sample': bucket UUIDs don’t match bf5e2d0ec35e7957ed96509b8ed7e13f != 15b15c78439db91ba73f27ac4d6ba116"}.

    Failure to authenticate returns 401 Unauthorized. An incorrectly specified URI returns 404 Object Not Found.

    Example

    The following example requests an immediate backup for the restRepo active repository:

    curl -v -X POST http://127.0.0.1:8097/api/v1/cluster/self/\
    repository/active/restRepo/backup \
    -u Administrator:password \
    -d '{"full_backup": false}'

    If successful, the call returns 200 OK, and a message such as the following:

    {"task_name":"BACKUP-6230b85e-f925-401d-a632-8688929263e2"}

    See Also

    An overview of the Backup Service is provided in Backup Service. A step-by-step guide to using Couchbase Web Console to configure and use the Backup Service is provided in Manage Backup and Restore. For information on scheduling backups by means of plans, see Create and Edit Plans.