• Cloud Server Backup Service

csbs
  1. Help Center
  2. Cloud Server Backup Service
  3. API Reference
  4. API Usage Guidelines
  5. Examples

Examples

This section describes how to invoke a CSBS API to create a backup for a cloud server.

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 headers.

  • 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. Obtain the token by following instructions in Obtaining a Project ID.
  3. Make a POST request using the address https://CSBS endpoint//v1/{project_id}/providers/fc4d5750-22e7-4798-8a46-f48f62c4c1da/resources/{resource_id}/action, where {project_id} is the ID you obtained in step 2 and {resource_id} is the server ID.
  4. In the request headers, add X-Auth-Token and set its value to be the token obtained in the previous step.
  5. Pass the following parameters to the response body:
    {
        "protect" : {
             "backup_name" : "database_backup", //Backup name (optional parameter)
             "description" : "backup for database version 2.2.1 before upgrade."  //Backup description (optional parameter)
      }
    }

    If the request is successful, the response contains the backup record ID (checkpoint_id).

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

  6. You can use checkpoint_id to filter backups. For detailed operations, see Querying All Backups. When the backup status changes to Available, the backup is successful.

    For details about error codes, see Status Codes.

  7. You can obtain the backup ID from the response body. After the backup, you can use the backup record ID and backup ID to specifically restore a server or delete a backup.