Set the data's validity period
Sets the TTL (Time to Live) for data stored in Time Series Database (TSDB). Data that exceeds the TTL is automatically expired and deleted.
Request syntax
| Path | Method |
|---|---|
/api/ttl | POST |
Request parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
val | Integer | Yes | The TTL in seconds. Valid values: 1 to 2147483647 (Integer.MAX\_VALUE). | 7776000 |
Example
Goal: Set the data's validity period to 90 days.
Request:
POST /api/ttlBody:
{ "val": 7776000 }Response
Returns HTTP status code 200 if the request succeeds. For a full list of status codes, see Response codes.
Get the data's validity period
Queries the current TTL for data stored in TSDB.
Request syntax
| Path | Method |
|---|---|
/api/ttl | GET |
Request parameters
No request body is required.
Response
Returns HTTP status code 200 if the request succeeds. For a full list of status codes, see Response codes.
Response body:
{ "val": 7776000 }The val field contains the current TTL value in seconds.