Updated on 2022-02-22 GMT+08:00

Getting Started

This section describes how to use CSBS APIs to back up a cloud server.

  • 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 Making an API Request.
  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. 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. 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.