Help Center/ GaussDB(DWS)/ API Reference/ Application Cases/ Using Postman to Call the API for Creating a Snapshot
Updated on 2022-09-15 GMT+08:00

Using Postman to Call the API for Creating a Snapshot

Scenarios

Use Postman to call the API for creating a snapshot. For details, see Calling APIs.

Involved APIs

When this API is called, authentication is required. The following APIs are involved:

  • Authentication: This API is used to authenticate identity to obtain the permission to operate APIs.
  • Creating a Snapshot: This API is used to create a snapshot for a cluster.

Procedure

  1. Configure the environment.

    Download Postman (7.24.0 is recommended) and call the snapshot creation service.

  2. Call services.

    1. Obtain the token for authentication.

      Create a POST request on Postman, select the Body configuration item, and enter the username, password, account name, and project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

      The region where the cloud service for obtaining the token is located must be the same as the region where the called service is located. Otherwise, the calling fails.

    2. Click Send in the upper right corner to send POST https://{{endpoint}}/v3/auth/tokens. Obtain the token value in the returned result. The token validity period is 24 hours.

    3. Call the API for creating a snapshot.
      • Create a POST request on Postman, select Headers, add the corresponding KEY and VALUE, and copy the token value to X-Auth-Token. The region in the request URL must be the same as that of the invoked service. You can obtain the region from "Regions and Endpoints".

      • Click Body and add the request parameter values to the request. Parameters vary by services. For details, see the API Description.

      • Click Send in the upper right corner to send POST https://dws.cn-north-4.myhuaweicloud.com/v1.0/{project_id}/snapshots and view the creation result.
        {
          "snapshot": {
              "id": "809bcf6e-4022-496d-9320-bbc700695692"
            }
        }