Request structure
Access link of the TSDB instance
On the instance details page, you can view the access link of an TSDB instance, for example, “ts-xxx.hitsdb.rds.aliyuncs.com:8242”.
Communication protocol
TSDB supports sending requests through HTTP.
Request method
TSDB supports sending requests by the HTTP POST method.
Request path
You must specify the API path for each request, that is, the specific action to take through API, for example, /api/delete_data
.
Request parameters
You can specify the parameters for data writing requests to determine the required returned content and the timeout.
Request content
You must specify the content of a request to determine the data content to access and the operations to perform.
Request Verbs
TSDB’s HTTP APIs are RESTful in nature, meaning it does it’s best to adhere to the REST protocol by using HTTP verbs to determine a course of action. For example, a GET request should only return data, a PUT or POST should modify data and DELETE should remove it.
However in some situations, verbs such as DELETE and PUT are blocked by firewalls, proxies or not implemented in clients. Furthermore, most developers are used to using GET and POST. Therefore, TSDB APIs allows you to add the query string parameter “method_override” to substitute the HTTP methods/verbs. This parameter allows clients to pass data for most API calls as query string values instead of HTTP body content. For example, you can delete certain data by issuing a GET request with the query string /api/delete_meta?m=cpu.usage&method_override=delete
.
The following table described the HTTP methods/verbs and their corresponding overrides.
HTTP Method | Description | Override parameter |
---|---|---|
GET | Obtains the data | N/A |
POST | Submits the data | method_override=post |
PUT | Overrides the data | method_override=put |
DELETE | Deletes the data | method_override=delete |