Request path and method

Request path Request method Description
/api/delete_data POST Deletes data.

Request parameters

Parameter Type Required Description Default value Example
metric String Yes The metric for the time series that you want to delete. None cpu
tags Map No The tags of the time series that you want to delete. This parameter is optional. If you leave this parameter empty, all the time series data for the metric is deleted. None See the sample requests.
fields List No The field data for the metric that you want to delete. None usage_system, usage_guest
start Integer Yes The beginning of the timestamp range to delete data. Unit: seconds. None 1499308591
end Integer No The end of the timestamp range to delete data. Unit: seconds. Current system time 1499508591
Notice
  • If you leave the fields parameter empty, Lindorm TSDB deletes all the time series data for the metric. For example, Lindorm TSDB deletes all the univariate data or all the field data for the metric.
  • If a time series contains the metric and tags that are specified in the request body, the time series is deleted, regardless of whether the time series contains other tags.

Sample requests in the JSON format

Objective: Delete all the time series data based on a metric. In this example, you set metric to cpu, start to 1499308591, and end to 1499508591. Request line: POST/api/delete_data. Request body:

    {
        "metric": "cpu",
        "start": 1499308591,
        "end": 1499508591
    }      

Objective: Delete all the time series data based on a metric and one or more tags. In this example, you set metric to cpu, start to 1499308591, and end to 1499508591. You also specify the host: 192.168.0.2 and appName: hitsdb tags. Request line: POST/api/delete_data. Request body:

    {
        "metric": "cpu",
        "tags": {
            "host": "192.168.0.2",
            "appName": "hitsdb"
        },
        "start": 1499308591,
        "end": 1499508591
    }      

Objective: Delete all the time series data based on the fields for a metric. In this example, you set metric to cpu, start to 1499308591, and end to 1499508591. You also specify the usage_system and usage_guest fields. Request line: POST/api/delete_data. Request body:

    {
        "metric": "cpu",
        "fields": ["usage_system", "usage_guest"],
        "start": 1499308591,
        "end": 1499508591
    } 

Responses

If the HTTP status code 200 is returned, the data is deleted. Otherwise, the data failed to be deleted. For more information, see HTTP status codes.