Updated on 2023-06-20 GMT+08:00

Getting Started

This section describes how to create a CSS cluster by using APIs. Figure 1 illustrates the API calling process.

Figure 1 API calling process

The token obtained on IAM is valid for only 24 hours. If you want to use one token for authentication, you can cache it to avoid frequent calling.

Involved APIs

If you use a token for authentication, you must obtain the token and add X-Auth-Token to the request header of the API when making an API call.

  • API for obtaining tokens from IAM
  • API for creating CSS clusters

Procedure

  1. Obtain the token. Send POST https://IAM endpoint/v3/auth/tokens.

    Obtain the token by following instructions in Authentication.

    The value of X-Subject-Token in the response header is the user token.

  2. Add Content-type and X-Auth-Token to the request header.
    • Content-Type: specifies the request body type or format. Its default value is application/json.
    • X-Auth-Token: Enter the user token obtained in 1.
  3. Send a cluster creation request and specify the following parameters in the request body:
    POST /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters
    { 
        "cluster": { 
            "name": "ES-Test",
            "backupStrategy": {
                "period": "16:00 GMT+08:00",
                "prefix": "snapshot",
                "keepday": 7
            },
            "instanceNum": 3,
               "instance": { 
                   "flavorRef": "ess.spec-2u16g", 
                      "volume": { 
                             "volume_type": "COMMON", 
                             "size": 100
                      }, 
                      "nics": { 
                             "vpcId": "fccd753c-91c3-40e2-852f-5ddf76d1a1b2",
                             "netId": "af1c65ae-c494-4e24-acd8-81d6b355c9f1", 
                             "securityGroupId": "7e3fed21-1a44-4101-ab29-34e57124f614" 
                      }
               }
        } 
    }
    View the response message. The following is an example response:
    {
      "cluster": {
        "id": "ef683016-871e-48bc-bf93-74a29d60d214",
        "name": "ES-Test"
      }
    }

    If the request is successful, 200 OK is returned.

    If the request fails, an error code and error information are returned. For details, see section Status Code.