Overview¶
TrueWatch Open API is a simplified HTTP REST API.
- Only GET / POST requests
- Use resource-oriented URLs to call the API
- Use status codes to indicate whether a request succeeds or fails
- All requests return JSON structures
- Open API programmatically accesses the TrueWatch platform
Supported Endpoints¶
Node Name | Endpoint |
---|---|
Overseas Region 1 (Oregon) | https://us1-openapi.truewatch.com |
Europe Region 1 (Frankfurt) | https://eu1-openapi.truewatch.com |
Asia-Pacific Region 1 (Singapore) | https://ap1-openapi.truewatch.com |
Africa Region 1 (South Africa) | https://za1-openapi.truewatch.com |
Indonesia Region 1 (Jakarta) | https://id1-openapi.truewatch.com |
Common Request Headers (Header)¶
Parameter Name | Type | Description |
---|---|---|
Content-Type | string | application/json |
DF-API-KEY | string | Caller identifier, see API Key Management |
Authentication Method¶
The interface uses API KEY as the authentication method. For each request, the value of DF-API-KEY in the request header is used for validity verification and as the basis for workspace limitation (the workspace to which this DF-API-KEY belongs).
All interfaces currently displayed by the Open API only require providing the API KEY (Header: DF-API-KEY) as credentials. If the credentials exist and are valid, it is considered authenticated.
Common Response Structure¶
Field | Type | Description |
---|---|---|
code | Number | The returned status code, consistent with the HTTP status code, fixed at 200 when there is no error |
content | String, Number, Array, Boolean, JSON | Returned data, the specific type of data returned depends on the actual business of the interface |
pageInfo | JSON | Pagination information for all list interface responses |
pageInfo.count | Number | Data count of the current page |
pageInfo.pageIndex | Number | Pagination page number |
pageInfo.pageSize | Number | Page size |
pageInfo.totalCount | Number | Total data count that meets the conditions |
errorCode | String | Returned error status code, empty indicates no error |
message | String | Specific description information corresponding to the returned error code |
success | Boolean | Fixed at true, indicating successful API invocation |
traceId | Boolean | traceId, used to track every request |
Request Example¶
GET Request¶
Example using the dashboard list acquisition interface¶
Request as follows:
curl "https://us1-openapi.truewatch.com/api/v1/dashboards/list?pageIndex=1&pageSize=10" \
-H "Content-Type: application/json" \
-H "DF-API-KEY: ${DF_API_KEY}" \
--compressed \
--insecure
Response result as follows:
{
"code":200,
"content":[
{Object}
],
"errorCode":"",
"message":"",
"pageInfo":{
"count":10,
"pageIndex":1,
"pageSize":10,
"totalCount":836
},
"success":true,
"traceId":"1749091119335873001"
}
POST Request¶
Example using the dashboard deletion interface¶
Request as follows:
curl "https://us1-openapi.truewatch.com/api/v1/dashboards/${dashboard_uuid}/delete" \
-X "POST" \
-H "Content-Type: application/json" \
-H "DF-API-KEY: ${DF_API_KEY}" \
--compressed \
--insecure
Response result as follows: