• Volume Backup Service

vbs
  1. Help Center
  2. Volume Backup Service
  3. API Reference
  4. API Calling
  5. Example

Example

This section describes how to create an AS group by calling a series of API APIs.

NOTE:
  • The token obtained from IAM is valid for only 24 hours. If you want to use one token for authentication, you can cache it to avoid frequently calling.

Involved APIs

To use token authentication, you need to obtain a token and add X-Auth-Token to the request header of API calls.

  • API for obtaining tokens from IAM
  • CSBS API for creating backups

Procedure

  1. Obtain the token by following instructions in Obtaining Request Authentication Information.
  2. Send POST https://VBS endpoint/v2/project ID/cloudbackups.
  3. Add the X-Auth-Token request header.
  4. Specify the following parameters in the request body:
    {
        "backup": {
            "volume_id": "c68ae7fb-0aa5-4a97-ab01-ed02c5b7e768",
            "name": "backup1",
            "description": "Backup_Demo",
            "tags":[{
                "key":"key",
                "value":"value"
             }]
        }
    }

    If the request is responded, a job ID is returned.

    If the request fails, an error code and error information are returned. For details, see Error Codes.

  1. Query job details using the job ID by referring to Querying the Job Status.

    If the returned job status is SUCCESS, the VBS backup is successfully created.

    For details about error codes, see Status Codes.

  2. You can obtain the backup ID (backup_id) from the job body and then use the IP to query or delete the backup, as well use the backup to restore data.