From be8cf9c0712cb67218ec670497d9237f65901a2a Mon Sep 17 00:00:00 2001 From: noramullen1 <42354779+noramullen1@users.noreply.github.com> Date: Mon, 12 Oct 2020 10:46:10 -0700 Subject: [PATCH] Commented out UI content --- content/v2.0/write-data/delete-data.md | 96 ++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 content/v2.0/write-data/delete-data.md diff --git a/content/v2.0/write-data/delete-data.md b/content/v2.0/write-data/delete-data.md new file mode 100644 index 000000000..4553868a0 --- /dev/null +++ b/content/v2.0/write-data/delete-data.md @@ -0,0 +1,96 @@ +--- +title: Delete data +list_title: Delete data +description: > + Delete data in the InfluxDB CLI and API. +menu: + v2_0: + name: Delete data + parent: Write data +weight: 104 +v2.0/tags: [delete] +related: + - /v2.0/reference/syntax/delete-predicate/ + - /v2.0/reference/cli/influx/delete/ +--- + + +## Delete data using the influx CLI + +1. Use the [`influx delete` command](/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](/v2.0/reference/syntax/delete-predicate/). + +##### 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"' +``` + +{{% warn %}} +Running `influx delete` without the `-p` or `--predicate` flag deletes all data with +timestamps between the specified `--start` and `--stop` times in the specified bucket. +{{% /warn %}} + +## Delete data using the API +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. +4. In your request payload, define the time range to delete data from with `start` and `stop`. + Specify which points to delete using the `predicate` and + [Delete predicate syntax](/v2.0/reference/syntax/delete-predicate/). + +##### Example delete request +```sh +curl -XPOST http://localhost:9999/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\"" + }' +``` + +_For more information, see the [`/delete` API documentation](/v2.0/api/#/paths/~1delete/post)._ + +{{% warn %}} +Using the `/delete` endpoint without a `predicate` deletes all data with +timestamps between the specified `start` and `stop` times in the specified bucket. +{{% /warn %}}