From 715ea048bee1fe2ca448e67dfc1330f63ba8e7b7 Mon Sep 17 00:00:00 2001 From: noramullen1 <42354779+noramullen1@users.noreply.github.com> Date: Mon, 12 Oct 2020 17:31:58 -0700 Subject: [PATCH] Address PR feedback --- .../influxdb/v2.0/write-data/delete-data.md | 65 ++++++++++++++----- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/content/influxdb/v2.0/write-data/delete-data.md b/content/influxdb/v2.0/write-data/delete-data.md index b6d49ee2a..4a31be3ef 100644 --- a/content/influxdb/v2.0/write-data/delete-data.md +++ b/content/influxdb/v2.0/write-data/delete-data.md @@ -51,7 +51,7 @@ Delete data from buckets you've created. You cannot delete data from system buck Use the `influx` CLI or the InfluxDB API `/delete` endpoint to delete data. {{% note %}} -The `-p, --predicate` flag is supported in InfluxDB Cloud and InfluxDB OSS 2.0 beta 16 or earlier. +The `-p, --predicate` flag is supported in **InfluxDB Cloud** and **InfluxDB OSS 2.0 beta 16 or earlier**. In InfluxDB OSS 2.0rc0, the `influx delete --predicate` flag has been disabled. {{% /note %}} @@ -61,15 +61,27 @@ In InfluxDB OSS 2.0rc0, the `influx delete --predicate` flag has been disabled. 1. Use the [`influx delete` command](/influxdb/v2.0/reference/cli/influx/delete/) to delete points from InfluxDB. 2. Specify your organization, bucket, and authentication token. 3. Define the time range to delete data from with the `--start` and `--stop` flags. -4. Specify which points to delete using the `--predicate` or `-p` flag and - [Delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/). +4. (InfluxDB Cloud only) Specify which points to delete using the predicate parameter and [delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/). + +### Example delete commands + +**InfluxDB OSS 2.0rc0** does not support the `predicate` parameter. + +#### Delete data in InfluxDB Cloud -##### Example delete command ```sh influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \ - --start '1970-01-01T00:00:00.00Z' \ - --stop '2020-01-01T00:00:00.00Z' \ - --predicate '_measurement="sensors" and sensorID="abc123"' + --start '1970-01-01T00:00:00.00Z' \ + --stop '2020-01-01T00:00:00.00Z' \ + --predicate '_measurement="sensors" and sensorID="abc123"' +``` + +#### Delete data in InfluxDB OSS + +```sh +influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \ + --start '1970-01-01T00:00:00.00Z' \ + --stop '2020-01-01T00:00:00.00Z' \ ``` {{% warn %}} @@ -78,6 +90,11 @@ timestamps between the specified `--start` and `--stop` times in the specified b {{% /warn %}} ## Delete data using the API + +{{% note %}} +The `influx` CLI is installed with InfluxDB OSS. If you're using InfluxDB Cloud and haven't already, download the [`influx` CLI](/influxdb/v2.0/get-started/#optional-download-install-and-use-the-influx-cli). +{{% /note %}} + 1. Use the InfluxDB API `/delete` endpoint to delete points from InfluxDB. 2. Include your organization and bucket as query parameters in the request URL. 3. Use the `Authorization` header to provide your InfluxDB authentication token. @@ -85,18 +102,34 @@ timestamps between the specified `--start` and `--stop` times in the specified b Specify which points to delete using the `predicate` and [Delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/). -##### Example delete request +### Example delete requests + +**InfluxDB OSS 2.0rc0** does not support the `predicate` parameter. + +#### Delete data in InfluxDB Cloud + ```sh -curl -XPOST http://localhost:8086/api/v2/delete/?org=myOrg&bucket=myBucket \ - -H 'Authorization: Token ' \ - -d '{ - "start": "1970-01-01T00:00:00.00Z", - "stop": "2020-01-01T00:00:00.00Z", - "predicate": "_measurement=\"sensors\" and sensorID=\"abc123\"" - }' +curl -X POST 'https://us-west-2-1.aws.cloud2.influxdata.com/api/v2/delete?orgID=' +-H 'Authorization: Token \" and _field=\"\"", +"start": "2020-08-16T08:00:00Z", +"stop": "2020-08-17T08:00:00Z" + }' ``` -_For more information, see the [`/delete` API documentation](/influxdb/v2.0/api/#/paths/~1delete/post)._ +#### Delete data in InfluxDB OSS + +```sh +curl -XPOST http://localhost:8086/api/v2/delete/?org=myOrg&bucket=myBucket \ +-H 'Authorization: Token ' \ +-d '{ +"start": "1970-01-01T00:00:00.00Z", +"stop": "2020-01-01T00:00:00.00Z" +}' +``` + _For more information, see the [`/delete` API documentation](/influxdb/v2.0/api/#/paths/~1delete/post)._ {{% warn %}} Using the `/delete` endpoint without a `predicate` deletes all data with