This topic introduces the instructions on using OceanBase Cloud Open API.
Prerequisites
For information on obtaining the AccessKey ID and AccessKey Secret, see AccessKey management.
How to use OceanBase Cloud Open API
The API call should contain the following:
- Domain: Different regions have different domains. For more information, refer to Service access point.
- Open API AccessKey: Authentication requires a public key and a private key.
- Request method: When submitting data to a resource through POST, PATCH, or PUT, the payload must be submitted in JSON format.
Request headers
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| X-Ob-Project-Id | string | No | The project ID. The project ID is passed in the request header to obtain information related to the specified project. If the project ID is not passed, the most recently passed-in project ID of the current account is used by default. | li15c8s987d2arse******** |
Invoke the Open API
Execute the following command in the terminal, where AccessKey ID and AccessKey Secret should be the AccessKey ID and AccessKey Secret of your account.
```
curl --digest -u 'AccessKey ID:AccessKey Secret' \
--request GET \
-H 'X-Ob-Project-Id':'projectId' \
--url https://< Open API domain name>/< Open API request path>
```
Response example
After the API call succeeded, the response status code is 200, and you will see the following information:
{ "success":true, "data":{ }, "requestId":"request-id-uuid" }After the API call failed, you will receive a response status code other than 200, and the following information is returned:
{ "success":false, "errorCode":"E001R000", "errorMessage":"Unknown Error", "requestId":"uuid" }