Request path and method

Request path Request method Description
/api/ttl POST Sets the time-to-live (TTL).

Request parameters

Parameter Type Required Description Example
val Integer Yes The value of the TTL. Unit: seconds. The value range is [1,2147483647]. You can use Integer.MAX_VALUE to represent the value 2147483647. If you use an ApsaraDB for Lindorm (Lindorm) instance of the High-availability Edition, the value range is [3600,2147483647]. If you set TTL to a value less than 3600, an error is reported. If you set TTL to 2147483647 or a greater value, the system determines that no TTL is configured. 7776000

Sample requests in the JSON format

Request line: POST/api/ttl

Request body:

{ "val": 7776000 }         

Responses

Only the HTTP status code 200 indicates a successful request. For more information about error codes, see HTTP status codes.

About the TTL

  1. The TTL is not calculated based on the timestamp of a data point. The TTL is calculated based on the time when the data point is written to the database.
  2. A data point does not become invalid immediately after the time for which the data point has been stored in the database exceeds the TTL. Instead, the data point remains in the database for some time before the database backend cleans up the data point.
  3. If the data point becomes invalid, the time series to which the data point belongs remains valid. If the time series has not been used for a long time, we recommend that you call specific operations to clean up data.

Query the TTL

Request path and method
Request path Request method Description
/api/ttl GET Queries the TTL.
Request parameters

No request body is required.

Responses

Only the HTTP status code 200 indicates a successful request. For more information about error codes, see HTTP status codes.

Sample responses in the JSON format
{ "val": 7776000 }

The value of val is the TTL. The unit is seconds.