fix: LInks and headings. Replace `latest` with `v2`. Specify OSS v2 in headings. Closes fix(api-refs): specify v2 in InfluxDB OSS headings #5866, Closes Flux docs: replace `/influxdb/latest` with `/influxdb/v2` #5864. Linting cleanup, removing terminal prompt from examples

pull/5870/head
Jason Stirnaman 2025-02-27 17:50:16 -06:00
parent 4887aa5b66
commit 4403dd9a18
29 changed files with 372 additions and 236 deletions

View File

@ -66,7 +66,7 @@ The tests defined in `compose.yaml` use the dependencies and execution
environment from this image. environment from this image.
```bash ```bash
docker build -t influxdata:docs-pytest -f Dockerfile.pytest . docker build -t influxdata/docs-pytest:latest -f Dockerfile.pytest .
``` ```
### Run the documentation locally (optional) ### Run the documentation locally (optional)

View File

@ -32,7 +32,8 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
python3-venv \ python3-venv \
rsync \ rsync \
telegraf \ telegraf \
wget wget \
yq
# Install InfluxDB 3 Core # Install InfluxDB 3 Core
RUN curl -O https://www.influxdata.com/d/install_influxdb3.sh \ RUN curl -O https://www.influxdata.com/d/install_influxdb3.sh \

View File

@ -84,6 +84,9 @@ services:
- type: volume - type: volume
source: test-content source: test-content
target: /app/content target: /app/content
- type: bind
source: ./test/shared/influxdb-templates
target: /root/influxdb-templates
working_dir: /app working_dir: /app
cloud-dedicated-pytest: cloud-dedicated-pytest:
container_name: cloud-dedicated-pytest container_name: cloud-dedicated-pytest

View File

@ -162,7 +162,7 @@ curl -XGET "localhost:8086/health"
### `/api/v2/buckets/` HTTP endpoint ### `/api/v2/buckets/` HTTP endpoint
The [/api/v2/buckets](/influxdb/latest/api/#tag/Buckets) endpoint accepts `GET`, `POST` and `DELETE` HTTP requests. Use this endpoint to [create](/influxdb/latest/api/#operation/PostBuckets), [delete](/influxdb/latest/api/#operation/DeleteBucketsID), [list](/influxdb/latest/api/#operation/GetBuckets), [update](/influxdb/latest/api/#operation/PatchBucketsID) and [retrieve](/influxdb/latest/api/#operation/GetBucketsID) buckets in your InfluxDB instance. Note that InfluxDB 2.x uses organizations and buckets instead of databases and retention policies. The [/api/v2/buckets](/influxdb/v2/api/#tag/Buckets) endpoint accepts `GET`, `POST` and `DELETE` HTTP requests. Use this endpoint to [create](/influxdb/v2/api/#operation/PostBuckets), [delete](/influxdb/v2/api/#operation/DeleteBucketsID), [list](/influxdb/v2/api/#operation/GetBuckets), [update](/influxdb/v2/api/#operation/PatchBucketsID) and [retrieve](/influxdb/v2/api/#operation/GetBucketsID) buckets in your InfluxDB instance. Note that InfluxDB 2.x uses organizations and buckets instead of databases and retention policies.
**Include the following URL parameters:** **Include the following URL parameters:**
@ -201,7 +201,7 @@ curl --request DELETE "http://localhost:8086/api/v2/buckets/test/autogen"
### `/api/v2/delete/` HTTP endpoint ### `/api/v2/delete/` HTTP endpoint
The [`/api/v2/delete`](/influxdb/latest/api/#tag/Delete) endpoint accepts `POST` HTTP requests. Use this endpoint to delete points from InfluxDB, including points with specific tag values, timestamps and measurements. The [`/api/v2/delete`](/influxdb/v2/api/#tag/Delete) endpoint accepts `POST` HTTP requests. Use this endpoint to delete points from InfluxDB, including points with specific tag values, timestamps and measurements.
**Include the following URL parameters:** **Include the following URL parameters:**
@ -353,8 +353,12 @@ curl http://localhost:8086/debug/requests
##### Track requests over a ten-second interval ##### Track requests over a ten-second interval
```bash ```bash
$ curl http://localhost:8086/debug/requests curl http://localhost:8086/debug/requests
```
The response body contains data in JSON format:
```JSON
{ {
"user1:123.45.678.91": {"writes":1,"queries":0}, "user1:123.45.678.91": {"writes":1,"queries":0},
} }
@ -365,8 +369,12 @@ The response shows that, over the past ten seconds, the `user1` user sent one re
##### Track requests over a one-minute interval ##### Track requests over a one-minute interval
```bash ```bash
$ curl http://localhost:8086/debug/requests?seconds=60 curl http://localhost:8086/debug/requests?seconds=60
```
The response body contains data in JSON format:
```JSON
{ {
"user1:123.45.678.91": {"writes":3,"queries":0}, "user1:123.45.678.91": {"writes":3,"queries":0},
"user1:000.0.0.0": {"writes":0,"queries":16}, "user1:000.0.0.0": {"writes":0,"queries":16},
@ -468,8 +476,12 @@ Those `SELECT` queries require a `POST` request.
###### Query data with a `SELECT` statement ###### Query data with a `SELECT` statement
```bash ```bash
$ curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"' curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
```
The response body contains data in JSON format:
```JSON
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:16:18Z",33.1,null,null],["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]} {"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:16:18Z",33.1,null,null],["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]}
``` ```
@ -490,8 +502,12 @@ time myfield mytag1 mytag2
##### Query data with a `SELECT` statement and an `INTO` clause ##### Query data with a `SELECT` statement and an `INTO` clause
```bash ```bash
$ curl -XPOST 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * INTO "newmeas" FROM "mymeas"' curl -XPOST 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * INTO "newmeas" FROM "mymeas"'
```
The response body contains data in JSON format:
```JSON
{"results":[{"statement_id":0,"series":[{"name":"result","columns":["time","written"],"values":[["1970-01-01T00:00:00Z",2]]}]}]} {"results":[{"statement_id":0,"series":[{"name":"result","columns":["time","written"],"values":[["1970-01-01T00:00:00Z",2]]}]}]}
``` ```
@ -503,8 +519,12 @@ Note that the system uses epoch 0 (`1970-01-01T00:00:00Z`) as a [null timestamp
##### Create a database ##### Create a database
```bash ```bash
$ curl -XPOST 'http://localhost:8086/query' --data-urlencode 'q=CREATE DATABASE "mydb"' curl -XPOST 'http://localhost:8086/query' --data-urlencode 'q=CREATE DATABASE "mydb"'
```
The response data is similar to the following:
```JSON
{"results":[{"statement_id":0}]} {"results":[{"statement_id":0}]}
``` ```
@ -536,7 +556,7 @@ See below for an [example](#create-a-database-using-basic-authentication) of bas
##### Query data with a `SELECT` statement and return pretty-printed JSON ##### Query data with a `SELECT` statement and return pretty-printed JSON
```bash ```bash
$ curl -G 'http://localhost:8086/query?db=mydb&pretty=true' --data-urlencode 'q=SELECT * FROM "mymeas"' curl -G 'http://localhost:8086/query?db=mydb&pretty=true' --data-urlencode 'q=SELECT * FROM "mymeas"'
{ {
"results": [ "results": [
@ -575,8 +595,12 @@ $ curl -G 'http://localhost:8086/query?db=mydb&pretty=true' --data-urlencode 'q=
##### Query data with a `SELECT` statement and return second precision epoch timestamps ##### Query data with a `SELECT` statement and return second precision epoch timestamps
```bash ```bash
$ curl -G 'http://localhost:8086/query?db=mydb&epoch=s' --data-urlencode 'q=SELECT * FROM "mymeas"' curl -G 'http://localhost:8086/query?db=mydb&epoch=s' --data-urlencode 'q=SELECT * FROM "mymeas"'
```
The response body data is similar to the following:
```bash
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[[1488327378,33.1,null,null],[1488327438,12.4,"12","14"]]}]}]} {"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[[1488327378,33.1,null,null],[1488327438,12.4,"12","14"]]}]}]}
``` ```
@ -586,7 +610,7 @@ The following example shows how to authenticate with v1.x credentials in the que
create a database: create a database:
```bash ```bash
$ curl -XPOST 'http://localhost:8086/query?u=myusername&p=mypassword' --data-urlencode 'q=CREATE DATABASE "mydb"' curl -XPOST 'http://localhost:8086/query?u=myusername&p=mypassword' --data-urlencode 'q=CREATE DATABASE "mydb"'
``` ```
The response body contains the following: The response body contains the following:
@ -698,26 +722,37 @@ Delimit multiple placeholder key-value pairs with comma `,`.
##### Send multiple queries ##### Send multiple queries
```bash ```bash
$ curl -G 'http://localhost:8086/query?db=mydb&epoch=s' --data-urlencode 'q=SELECT * FROM "mymeas";SELECT mean("myfield") FROM "mymeas"' curl -G 'http://localhost:8086/query?db=mydb&epoch=s' --data-urlencode 'q=SELECT * FROM "mymeas";SELECT mean("myfield") FROM "mymeas"'
```
The response body contains results for both queries:
```JSON
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[[1488327378,33.1,null,null],[1488327438,12.4,"12","14"]]}]},{"statement_id":1,"series":[{"name":"mymeas","columns":["time","mean"],"values":[[0,22.75]]}]}]} {"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[[1488327378,33.1,null,null],[1488327438,12.4,"12","14"]]}]},{"statement_id":1,"series":[{"name":"mymeas","columns":["time","mean"],"values":[[0,22.75]]}]}]}
``` ```
The request includes two queries: `SELECT * FROM "mymeas"` and `SELECT mean("myfield") FROM "mymeas"'`. - The request includes two queries: `SELECT * FROM "mymeas"` and `SELECT mean("myfield") FROM "mymeas"'`.
In the results, the system assigns a statement identifier to each query return. - In the results, InfluxDB assigns a statement identifier to each query:
The first query's result has a `statement_id` of `0` and the second query's result has a `statement_id` of `1`. - `"statement_id": 0`: the first query
- `"statement_id": 1`: the second query
##### Request query results in CSV format ##### Request query results in CSV format
```bash To format results in CSV, specify `application/csv` in the HTTP `Accept` header--for example:
$ curl -H "Accept: application/csv" -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
```bash
curl -H "Accept: application/csv" -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
```
The response body contains data in CSV format:
```csv
name,tags,time,myfield,mytag1,mytag2 name,tags,time,myfield,mytag1,mytag2
mymeas,,1488327378000000000,33.1,mytag1,mytag2 mymeas,,1488327378000000000,33.1,mytag1,mytag2
mymeas,,1488327438000000000,12.4,12,14 mymeas,,1488327438000000000,12.4,12,14
``` ```
The first point has no [tag values](/enterprise_influxdb/v1/concepts/glossary/#tag-value) for the `mytag1` and `mytag2` [tag keys](/enterprise_influxdb/v1/concepts/glossary/#tag-key). - In the sample data, the first point doesn't contain [tag values](/enterprise_influxdb/v1/concepts/glossary/#tag-value) for the `mytag1` and `mytag2` [tag keys](/enterprise_influxdb/v1/concepts/glossary/#tag-key).
##### Submit queries from a file ##### Submit queries from a file
@ -734,57 +769,77 @@ CREATE RETENTION POLICY four_weeks ON mydb DURATION 4w REPLICATION 1;
##### Bind a parameter in the `WHERE` clause to specific tag value ##### Bind a parameter in the `WHERE` clause to specific tag value
```bash Use the `params` option to pass arguments for a parameterized query--for example:
$ curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "mytag1" = $tag_value' --data-urlencode 'params={"tag_value":"12"}'
```bash
curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "mytag1" = $tag_value' --data-urlencode 'params={"tag_value":"12"}'
```
The response data is similar to the following:
```JSON
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]} {"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]}
``` ```
The request maps `$tag_value` to `12`. - In the request, `params` maps `$tag_value` to `"12"`.
InfluxDB stores [tag values](/enterprise_influxdb/v1/concepts/glossary/#tag-value) as strings they and must be double quoted in the request. Because InfluxDB stores [tag values](/enterprise_influxdb/v1/concepts/glossary/#tag-value) as strings, you must double-quote them in parameter values.
- During query execution, InfluxDB substitutes the parameter values for the associated keys in the query.
##### Bind a parameter in the `WHERE` clause to a numerical field value ##### Bind a parameter in the `WHERE` clause to a numerical field value
```bash ```bash
$ curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "myfield" > $field_value' --data-urlencode 'params={"field_value":30}' curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "myfield" > $field_value' --data-urlencode 'params={"field_value":30}'
```
The response data is similar to the following:
```JSON
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:16:18Z",33.1,null,null]]}]}]} {"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:16:18Z",33.1,null,null]]}]}]}
``` ```
The request maps `$field_value` to `30`. - In the request, `params` maps `$field_value` to `30`. Because `myfield` stores numerical [field values](/enterprise_influxdb/v1/concepts/glossary/#field-value), the parameter value `30` does not require double quotes.
The value `30` does not require double quotes because `myfield` stores numerical [field values](/enterprise_influxdb/v1/concepts/glossary/#field-value). - During query execution, InfluxDB substitutes the parameter values for the associated keys in the query.
##### Bind two parameters in the `WHERE` clause to a specific tag value and numerical field value ##### Bind two parameters in the `WHERE` clause to a specific tag value and numerical field value
```bash ```bash
$ curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "mytag1" = $tag_value AND "myfield" < $field_value' --data-urlencode 'params={"tag_value":"12","field_value":30}' curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "mytag1" = $tag_value AND "myfield" < $field_value' --data-urlencode 'params={"tag_value":"12","field_value":30}'
```
The response data is similar to the following:
```JSON
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]} {"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]}
``` ```
The request maps `$tag_value` to `12` and `$field_value` to `30`. - In the request, `params` maps `$tag_value` to `12` and `$field_value` to `30`.
- During query execution, InfluxDB substitutes the parameter values for the associated keys in the query.
#### Status codes and responses #### Status codes and responses
The API response body contains results or error messages in JSON format. The API response body contains results or error messages in JSON format.
To pretty-print JSON for viewing, include the query string parameter `pretty=true` To pretty-print JSON for viewing, include the query string parameter `pretty=true`
or pipe the response to a JSON-processor like [**jq**](https://stedolan.github.io/jq/). or pipe the response to a JSON-processor, such as [**jq**](https://stedolan.github.io/jq/).
##### Summary table ##### Summary table
| HTTP status code | Description | | HTTP status code | Description |
| :--------------- | :---------- | | :--------------- | :---------- |
| 200 OK | Success. Response body contains data in JSON format. | | `200 OK` | Success. Response body contains data in JSON format. |
| 400 Bad Request | Unacceptable request. Can occur with a syntactically incorrect query. Response body contains an error message with additional information in JSON format. | | `400 Bad Request` | Unacceptable request. Can occur with a syntactically incorrect query. Response body contains an error message with additional information in JSON format. |
| 401 Unauthorized | Unacceptable request. Can occur with invalid authentication credentials. | | `401 Unauthorized` | Unacceptable request. Can occur with invalid authentication credentials. |
#### Examples #### Examples
##### A successful request that returns data ##### A successful request that returns data
```bash ```bash
$ curl -i -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"' curl -i -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
```
The response is HTTP status `200 OK` and the body contains data in JSON format:
```
HTTP/1.1 200 OK HTTP/1.1 200 OK
Connection: close Connection: close
Content-Type: application/json Content-Type: application/json
@ -799,8 +854,11 @@ Transfer-Encoding: chunked
##### A query that contains an error ##### A query that contains an error
```bash ```bash
$ curl -i -G 'http://localhost:8086/query?db=mydb1' --data-urlencode 'q=SELECT * FROM "mymeas"' curl -i -G 'http://localhost:8086/query?db=mydb1' --data-urlencode 'q=SELECT * FROM "mymeas"'
The response body contains details about the error:
```
HTTP/1.1 200 OK HTTP/1.1 200 OK
Connection: close Connection: close
Content-Type: application/json Content-Type: application/json
@ -815,8 +873,13 @@ Transfer-Encoding: chunked
##### An incorrectly formatted query ##### An incorrectly formatted query
```bash ```bash
$ curl -i -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT *' curl -i -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT *'
```
The response is HTTP status `400 Bad Request` and the body contains details
about the error:
```
HTTP/1.1 400 Bad Request HTTP/1.1 400 Bad Request
Content-Type: application/json Content-Type: application/json
Request-Id: [...] Request-Id: [...]
@ -830,8 +893,12 @@ Content-Length: 76
##### A request with invalid authentication credentials ##### A request with invalid authentication credentials
```bash ```bash
$ curl -i -XPOST 'http://localhost:8086/query?u=myusername&p=notmypassword' --data-urlencode 'q=CREATE DATABASE "mydb"' curl -i -XPOST 'http://localhost:8086/query?u=myusername&p=notmypassword' --data-urlencode 'q=CREATE DATABASE "mydb"'
```
The response is HTTP status `401 Unauthorized` and the body contains the error message.
```
HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized
Content-Type: application/json Content-Type: application/json
Request-Id: [...] Request-Id: [...]
@ -878,8 +945,12 @@ in significant improvements in compression.
##### Write a point to the database `mydb` with a timestamp in seconds ##### Write a point to the database `mydb` with a timestamp in seconds
```bash ```bash
$ curl -i -XPOST "http://localhost:8086/write?db=mydb&precision=s" --data-binary 'mymeas,mytag=1 myfield=90 1463683075' curl -i -XPOST "http://localhost:8086/write?db=mydb&precision=s" --data-binary 'mymeas,mytag=1 myfield=90 1463683075'
```
A successful write returns HTTP status `204 No Content`--for example:
```
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Content-Type: application/json Content-Type: application/json
Request-Id: [...] Request-Id: [...]
@ -890,13 +961,7 @@ Date: Wed, 08 Nov 2017 17:33:23 GMT
##### Write a point to the database `mydb` and the retention policy `myrp` ##### Write a point to the database `mydb` and the retention policy `myrp`
```bash ```bash
$ curl -i -XPOST "http://localhost:8086/write?db=mydb&rp=myrp" --data-binary 'mymeas,mytag=1 myfield=90' curl -i -XPOST "http://localhost:8086/write?db=mydb&rp=myrp" --data-binary 'mymeas,mytag=1 myfield=90'
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: [...]
X-Influxdb-Version: {{< latest-patch >}}
Date: Wed, 08 Nov 2017 17:34:31 GMT
``` ```
##### Write a point to the database `mydb` using HTTP authentication ##### Write a point to the database `mydb` using HTTP authentication
@ -904,20 +969,25 @@ Date: Wed, 08 Nov 2017 17:34:31 GMT
Valid credentials: Valid credentials:
```bash ```bash
$ curl -i -XPOST "http://localhost:8086/write?db=mydb&u=myusername&p=mypassword" --data-binary 'mymeas,mytag=1 myfield=91' curl -i -XPOST "http://localhost:8086/write?db=mydb&u=myusername&p=mypassword" --data-binary 'mymeas,mytag=1 myfield=91'
```
A successful write returns HTTP status `204 No Content`.
```
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: [...]
X-Influxdb-Version: {{< latest-patch >}}
Date: Wed, 08 Nov 2017 17:34:56 GMT
``` ```
Invalid credentials: Invalid credentials:
```bash ```bash
$ curl -i -XPOST "http://localhost:8086/write?db=mydb&u=myusername&p=notmypassword" --data-binary 'mymeas,mytag=1 myfield=91' curl -i -XPOST "http://localhost:8086/write?db=mydb&u=myusername&p=notmypassword" --data-binary 'mymeas,mytag=1 myfield=91'
```
If the username or password is incorrect, the response status is `401 Unauthorized`
and the response body contains the error message--for example:
```
HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized
Content-Type: application/json Content-Type: application/json
Request-Id: [...] Request-Id: [...]
@ -931,23 +1001,20 @@ Content-Length: 33
##### Write a point to the database `mydb` using basic authentication ##### Write a point to the database `mydb` using basic authentication
Valid credentials:
```bash ```bash
$ curl -i -XPOST -u myusername:mypassword "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=91' curl -i -XPOST -u myusername:mypassword "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=91'
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: [...]
X-Influxdb-Version: {{< latest-patch >}}
Date: Wed, 08 Nov 2017 17:36:40 GMT
``` ```
Invalid credentials: Invalid credentials:
```bash ```bash
$ curl -i -XPOST -u myusername:notmypassword "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=91' curl -i -XPOST -u myusername:notmypassword "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=91'
```
If the username or password is incorrect, the response status is `401 Unauthorized`
and the response body contains the error message--for example:
```
HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized
Content-Type: application/json Content-Type: application/json
Request-Id: [...] Request-Id: [...]
@ -965,79 +1032,65 @@ Content-Length: 33
--data-binary '<Data in InfluxDB line protocol format>' --data-binary '<Data in InfluxDB line protocol format>'
``` ```
All data must be binary encoded and in the Data to write must be binary encoded and in the
[InfluxDB line protocol](/enterprise_influxdb/v1/concepts/glossary/#influxdb-line-protocol) format. [InfluxDB line protocol](/enterprise_influxdb/v1/concepts/glossary/#influxdb-line-protocol) format.
Our example shows the `--data-binary` parameter from curl, which we will use in
all examples on this page. Examples in this page use `curl` with the `--data-binary` parameter to encode
line protocol in the request.
Using any encoding method other than `--data-binary` will likely lead to issues; Using any encoding method other than `--data-binary` will likely lead to issues;
`-d`, `--data-urlencode`, and `--data-ascii` may strip out newlines or `-d`, `--data-urlencode`, and `--data-ascii` may strip out newlines or
introduce new, unintended formatting. introduce unintended formatting.
Options: Options:
* Write several points to the database with one request by separating each point - Write several points to the database with one request by separating each point
by a new line. by a new line.
* Write points from a file with the `@` flag. - Write points from a file with the `@` flag.
The file should contain a batch of points in the InfluxDB line protocol format. The file should contain a batch of points in line protocol format.
Individual points must be on their own line and separated by newline characters Individual points must be on their own line and separated by newline characters
(`\n`). (`\n`).
Files containing carriage returns will cause parser errors. Files containing carriage returns cause parser errors.
We recommend writing points in batches of 5,000 to 10,000 points. > [!Important]
Smaller batches, and more HTTP requests, will result in sub-optimal performance. > #### Batch writes for optimal performance
> Write points in batches of 5,000 to 10,000 points.
> Smaller batches, and more HTTP requests, will result in sub-optimal performance.
#### Examples #### Examples
##### Write a point to the database `mydb` with a nanosecond timestamp ##### Write a point with a nanosecond timestamp to the `mydb` database
```bash ```bash
$ curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=90 1463683075000000000' curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=90 1463683075000000000'
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: [...]
X-Influxdb-Version: {{< latest-patch >}}
Date: Wed, 08 Nov 2017 18:02:57 GMT
``` ```
##### Write a point to the database `mydb` with the local server's nanosecond timestamp If successful, the response status is HTTP `204 No Content`.
```bash
$ curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=90'
```
HTTP/1.1 204 No Content HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: [...]
X-Influxdb-Version: {{< latest-patch >}}
Date: Wed, 08 Nov 2017 18:03:44 GMT
``` ```
##### Write several points to the database `mydb` by separating points with a new line ##### Write a point with the local server's nanosecond timestamp to the `mydb` database
```bash ```bash
$ curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=3 myfield=89 1463689152000000000 curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=90'
```
##### Write several points to the database by separating points with a new line
```bash
curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=3 myfield=89 1463689152000000000
mymeas,mytag=2 myfield=34 1463689152000000000' mymeas,mytag=2 myfield=34 1463689152000000000'
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: [...]
X-Influxdb-Version: {{< latest-patch >}}
Date: Wed, 08 Nov 2017 18:04:02 GMT
``` ```
##### Write several points to the database `mydb` from the file `data.txt` ##### Write several points to the database `mydb` from the file `data.txt`
```bash ```bash
$ curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary @data.txt curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary @data.txt
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: [...]
X-Influxdb-Version: {{< latest-patch >}}
Date: Wed, 08 Nov 2017 18:08:11 GMT
``` ```
A sample of the data in `data.txt`: `data.txt` contains the following sample data:
``` ```
mymeas,mytag1=1 value=21 1463689680000000000 mymeas,mytag1=1 value=21 1463689680000000000
mymeas,mytag1=1 value=34 1463689690000000000 mymeas,mytag1=1 value=34 1463689690000000000
@ -1132,7 +1185,7 @@ Requests to `/shard-status` return the following information in JSON format:
- `size`: the size on disk of the shard in bytes - `size`: the size on disk of the shard in bytes
- `is_hot`: whether the time range from the shard includes `now` - `is_hot`: whether the time range from the shard includes `now`
{{% note %}} {{% note %}}
An *idle* shard is fully compacted and not receiving new (potentially historical) writes. An _idle_ shard is fully compacted and not receiving new (potentially historical) writes.
A hot shard may or may not be idle. A hot shard may or may not be idle.
{{% /note %}} {{% /note %}}
- `state`: the anti-entropy status of the shard can be one of the following: - `state`: the anti-entropy status of the shard can be one of the following:

View File

@ -4,7 +4,7 @@ description: >
Use [`join.time()`](/flux/v0/stdlib/join/time/) to join two streams of data Use [`join.time()`](/flux/v0/stdlib/join/time/) to join two streams of data
based on time values in the `_time` column. based on time values in the `_time` column.
This type of join operation is common when joining two streams of This type of join operation is common when joining two streams of
[time series data](/influxdb/latest/reference/glossary/#time-series-data). [time series data](/influxdb/v2/reference/glossary/#time-series-data).
menu: menu:
flux_v0: flux_v0:
parent: Join data parent: Join data
@ -31,7 +31,7 @@ list_code_example: |
Use [`join.time()`](/flux/v0/stdlib/join/time/) to join two streams of data Use [`join.time()`](/flux/v0/stdlib/join/time/) to join two streams of data
based on time values in the `_time` column. based on time values in the `_time` column.
This type of join operation is common when joining two streams of This type of join operation is common when joining two streams of
[time series data](/influxdb/latest/reference/glossary/#time-series-data). [time series data](/influxdb/v2/reference/glossary/#time-series-data).
`join.time()` can use any of the available join methods. `join.time()` can use any of the available join methods.
Which method you use depends on your desired behavior: Which method you use depends on your desired behavior:

View File

@ -86,7 +86,7 @@ Durations are relative to `now()`.
URL of the InfluxDB instance to query. URL of the InfluxDB instance to query.
See [InfluxDB OSS URLs](/influxdb/latest/reference/urls/) See [InfluxDB OSS URLs](/influxdb/v2/reference/urls/)
or [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/). or [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/).
### org ### org
@ -97,7 +97,7 @@ Organization name.
### token ### token
InfluxDB [API token](/influxdb/latest/security/tokens/). InfluxDB [API token](/influxdb/v2/security/tokens/).

View File

@ -119,7 +119,7 @@ Records that evaluate to _null_ or `false` are not included in the output tables
URL of the InfluxDB instance to query. URL of the InfluxDB instance to query.
See [InfluxDB OSS URLs](/influxdb/latest/reference/urls/) See [InfluxDB OSS URLs](/influxdb/v2/reference/urls/)
or [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/). or [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/).
### org ### org
@ -130,7 +130,7 @@ Organization name.
### token ### token
InfluxDB [API token](/influxdb/latest/security/tokens/). InfluxDB [API token](/influxdb/v2/security/tokens/).

View File

@ -1,7 +1,7 @@
--- ---
title: csv.from() function title: csv.from() function
description: > description: >
`csv.from()` retrieves [annotated CSV](/influxdb/latest/reference/syntax/annotated-csv/) **from a URL**. `csv.from()` retrieves [annotated CSV](/influxdb/v2/reference/syntax/annotated-csv/) **from a URL**.
menu: menu:
flux_v0_ref: flux_v0_ref:
name: csv.from name: csv.from
@ -26,7 +26,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
-------------------------------------------------------------------------------> ------------------------------------------------------------------------------->
`csv.from()` retrieves [annotated CSV](/influxdb/latest/reference/syntax/annotated-csv/) **from a URL**. `csv.from()` retrieves [annotated CSV](/influxdb/v2/reference/syntax/annotated-csv/) **from a URL**.
{{% warn %}} {{% warn %}}
#### Deprecated #### Deprecated

View File

@ -63,7 +63,7 @@ Geometry Library to generate `s2_cell_id` tags.
Specify your [S2 Cell ID level](https://s2geometry.io/resources/s2cell_statistics.html). Specify your [S2 Cell ID level](https://s2geometry.io/resources/s2cell_statistics.html).
**Note:** To filter more quickly, use higher S2 Cell ID levels, but know that **Note:** To filter more quickly, use higher S2 Cell ID levels, but know that
higher levels increase [series cardinality](/influxdb/latest/reference/glossary/#series-cardinality). higher levels increase [series cardinality](/influxdb/v2/reference/glossary/#series-cardinality).
Language-specific implementations of the S2 Geometry Library provide methods for Language-specific implementations of the S2 Geometry Library provide methods for
generating S2 Cell ID tokens. For example: generating S2 Cell ID tokens. For example:

View File

@ -29,7 +29,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
`prometheus.histogramQuantile()` calculates a quantile on a set of Prometheus histogram values. `prometheus.histogramQuantile()` calculates a quantile on a set of Prometheus histogram values.
This function supports [Prometheus metric parsing formats](/influxdb/latest/reference/prometheus-metrics/) This function supports [Prometheus metric parsing formats](/influxdb/v2/reference/prometheus-metrics/)
used by `prometheus.scrape()`, the Telegraf `promtheus` input plugin, and used by `prometheus.scrape()`, the Telegraf `promtheus` input plugin, and
InfluxDB scrapers available in InfluxDB OSS. InfluxDB scrapers available in InfluxDB OSS.
@ -53,7 +53,7 @@ Quantile to compute. Must be a float value between 0.0 and 1.0.
### metricVersion ### metricVersion
[Prometheus metric parsing format](/influxdb/latest/reference/prometheus-metrics/) [Prometheus metric parsing format](/influxdb/v2/reference/prometheus-metrics/)
used to parse queried Prometheus data. used to parse queried Prometheus data.
Available versions are `1` and `2`. Available versions are `1` and `2`.
Default is `2`. Default is `2`.

View File

@ -86,7 +86,7 @@ _`bucket` and `bucketID` are mutually exclusive_.
URL of the InfluxDB instance to write to. URL of the InfluxDB instance to write to.
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/) See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/). or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
`host` is required when writing to a remote InfluxDB instance. `host` is required when writing to a remote InfluxDB instance.
If specified, `token` is also required. If specified, `token` is also required.

View File

@ -72,7 +72,7 @@ _`org` and `orgID` are mutually exclusive_.
URL of the InfluxDB instance. URL of the InfluxDB instance.
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/) See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/). or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
_`host` is required when `org` or `orgID` are specified._ _`host` is required when `org` or `orgID` are specified._
### token ### token

View File

@ -90,7 +90,7 @@ String-encoded organization ID.
URL of the InfluxDB instance to query. URL of the InfluxDB instance to query.
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/) See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/). or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
### token ### token

View File

@ -81,7 +81,7 @@ _`bucket` and `bucketID` are mutually exclusive_.
URL of the InfluxDB instance to query. URL of the InfluxDB instance to query.
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/) See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/). or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
### org ### org

View File

@ -91,7 +91,7 @@ _`bucket` and `bucketID` are mutually exclusive_.
URL of the InfluxDB instance to write to. URL of the InfluxDB instance to write to.
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/) See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/). or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
`host` is required when writing to a remote InfluxDB instance. `host` is required when writing to a remote InfluxDB instance.
If specified, `token` is also required. If specified, `token` is also required.

View File

@ -81,7 +81,7 @@ _`bucket` and `bucketID` are mutually exclusive_.
URL of the InfluxDB instance to write to. URL of the InfluxDB instance to write to.
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/) See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/). or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
`host` is required when writing to a remote InfluxDB instance. `host` is required when writing to a remote InfluxDB instance.
If specified, `token` is also required. If specified, `token` is also required.

View File

@ -24,7 +24,7 @@ UI and export the resources as a template.
{{< youtube 714uHkxKM6U >}} {{< youtube 714uHkxKM6U >}}
{{% note %}} {{% note %}}
#### InfluxDB OSS for creating templates #### InfluxDB OSS v2 for creating templates
Templatable resources are scoped to a single organization, so the simplest way to create a Templatable resources are scoped to a single organization, so the simplest way to create a
template is to create a new organization, build the template within the organization, template is to create a new organization, build the template within the organization,
and then [export all resources](#export-all-resources) as a template. and then [export all resources](#export-all-resources) as a template.
@ -54,15 +54,21 @@ Provide the following:
**JSON** (`.json`) are supported. **JSON** (`.json`) are supported.
###### Export all resources to a template ###### Export all resources to a template
```sh
# Syntax
influx export all -o <INFLUX_ORG> -f <FILE_PATH> -t <INFLUX_TOKEN>
<!--pytest.mark.skip-->
```bash
# Syntax
influx export all --org <INFLUX_ORG> --file <FILE_PATH> --token <INFLUX_TOKEN>
```
<!--The following fails due to an apparent missing task query in the account-->
<!--pytest.mark.skip-->
```bash
# Example # Example
influx export all \ influx export all \
-o my-org \ --org $INFLUX_ORG \
-f ~/templates/awesome-template.yml \ --file /path/to/TEMPLATE_FILE.yml \
-t $INFLUX_TOKEN --token $INFLUX_TOKEN
``` ```
#### Export resources filtered by labelName or resourceKind #### Export resources filtered by labelName or resourceKind
@ -81,9 +87,9 @@ and
```sh ```sh
influx export all \ influx export all \
-o my-org \ --org $INFLUX_ORG \
-f ~/templates/awesome-template.yml \ --file /path/to/TEMPLATE_FILE.yml \
-t $INFLUX_TOKEN \ --token $INFLUX_TOKEN \
--filter=resourceKind=Bucket \ --filter=resourceKind=Bucket \
--filter=resourceKind=Dashboard \ --filter=resourceKind=Dashboard \
--filter=labelName=Example1 \ --filter=labelName=Example1 \
@ -94,12 +100,14 @@ For information about flags, see the
[`influx export all` documentation](/influxdb/cloud/reference/cli/influx/export/all/). [`influx export all` documentation](/influxdb/cloud/reference/cli/influx/export/all/).
### Export specific resources ### Export specific resources
To export specific resources within an organization to a template manifest, To export specific resources within an organization to a template manifest,
use the `influx export` with resource flags for each resource to include. use the `influx export` with resource flags for each resource to include.
The command uses the API token to filter resources for the organization.
Provide the following: Provide the following:
- **Organization name** or **ID** - **API token** with read access to the organization.
- **API token** with read access to the organization
- **Destination path and filename** for the template manifest. - **Destination path and filename** for the template manifest.
The filename extension determines the template format—both **YAML** (`.yml`) and The filename extension determines the template format—both **YAML** (`.yml`) and
**JSON** (`.json`) are supported. **JSON** (`.json`) are supported.
@ -108,15 +116,20 @@ Provide the following:
[`influx export` documentation](/influxdb/cloud/reference/cli/influx/export/). [`influx export` documentation](/influxdb/cloud/reference/cli/influx/export/).
###### Export specific resources to a template ###### Export specific resources to a template
```sh
# Syntax
influx export all -o <INFLUX_ORG> -f <FILE_PATH> -t <INFLUX_TOKEN> [resource-flags]
<!--pytest.mark.skip-->
```bash
# Syntax
influx export --file <FILE_PATH> --token <INFLUX_TOKEN> [resource-flags]
```
<!-- Fails due to resource ID placeholders -->
<!--pytest.mark.xfail-->
```bash
# Example # Example
influx export all \ influx export \
-o my-org \ --file /path/to/TEMPLATE_FILE.yml \
-f ~/templates/awesome-template.yml \ --token $INFLUX_TOKEN \
-t $INFLUX_TOKEN \
--buckets=00x000ooo0xx0xx,o0xx0xx00x000oo \ --buckets=00x000ooo0xx0xx,o0xx0xx00x000oo \
--dashboards=00000xX0x0X00x000 \ --dashboards=00000xX0x0X00x000 \
--telegraf-configs=00000x0x000X0x0X0 --telegraf-configs=00000x0x000X0x0X0
@ -125,9 +138,10 @@ influx export all \
### Export a stack ### Export a stack
To export a stack and all its associated resources as a template, use the To export a stack and all its associated resources as a template, use the
`influx export stack` command. `influx export stack` command.
The command uses the API token to filter resources for the organization.
Provide the following: Provide the following:
- **Organization name** or **ID**
- **API token** with read access to the organization - **API token** with read access to the organization
- **Destination path and filename** for the template manifest. - **Destination path and filename** for the template manifest.
The filename extension determines the template format—both **YAML** (`.yml`) and The filename extension determines the template format—both **YAML** (`.yml`) and
@ -135,19 +149,23 @@ Provide the following:
- **Stack ID** - **Stack ID**
###### Export a stack as a template ###### Export a stack as a template
```sh
<!--pytest.mark.skip-->
```bash
# Syntax # Syntax
influx export stack \ influx export stack \
-o <INFLUX_ORG> \ --token <INFLUX_TOKEN> \
-t <INFLUX_TOKEN> \ --file <FILE_PATH> \
-f <FILE_PATH> \
<STACK_ID> <STACK_ID>
```
<!-- Fails due to non-existent STACK_ID -->
<!--pytest.mark.xfail-->
```bash
# Example # Example
influx export stack \ influx export stack \
-o my-org \ -t $INFLUX_TOKEN \
-t mYSuP3RS3CreTt0K3n -f /path/to/TEMPLATE_FILE.yml \
-f ~/templates/awesome-template.yml \
05dbb791a4324000 05dbb791a4324000
``` ```
@ -206,11 +224,47 @@ when [applying the template](/influxdb/cloud/tools/influxdb-templates/use/#apply
Users can also include the `--env-ref` flag with the appropriate key-value pair Users can also include the `--env-ref` flag with the appropriate key-value pair
when installing the template. when installing the template.
<!-- //REVIEW I can't get this to work with environment reference substitution
-- Skipping the test for now, but we should review it and fix it.
-->
<!--pytest.mark.skip-->
<!--test:setup
```sh ```sh
# Set bucket-name-1 to "myBucket" jq -n '{
apiVersion: "influxdata.com/v2alpha1",
kind: "Bucket",
metadata: {
name: {
envRef: {
key: "bucket-name-1"
}
}
}
}' > /path/to/TEMPLATE_FILE.json
chmod +rx /path/to/TEMPLATE_FILE.json
# View formatted JSON
jq '.' /path/to/TEMPLATE_FILE.json
```
-->
For example, to set a custom bucket name when applying a template with an environment reference:
<!--pytest-codeblocks:cont-->
```sh
# The template, edited to include an environment reference:
# apiVersion: influxdata.com/v2alpha1
# kind: Bucket
# metadata:
# name:
# envRef: bucket-name-1
# Apply template, set bucket-name-1 to "myBucket", and skip verification
influx apply \ influx apply \
-f /path/to/template.yml \ --file /path/to/TEMPLATE_FILE.json \
--env-ref=bucket-name-1=myBucket --env-ref bucket-name-1=myBucket \
--force yes
--org $INFLUX_ORG
--token $INFLUX_TOKEN
``` ```
_If sharing your template, we recommend documenting what environment references _If sharing your template, we recommend documenting what environment references

View File

@ -8,7 +8,7 @@ menu:
weight: 70 weight: 70
parent: Concepts parent: Concepts
aliases: aliases:
- /influxdb/latest/concepts/time-series-index/ - /influxdb/v2/concepts/time-series-index/
--- ---
Find overview and background information on Time Series Index (TSI) in this topic. For detail, including how to enable and configure TSI, see [Time Series Index (TSI) details](/influxdb/v1/concepts/tsi-details/). Find overview and background information on Time Series Index (TSI) in this topic. For detail, including how to enable and configure TSI, see [Time Series Index (TSI) details](/influxdb/v1/concepts/tsi-details/).

View File

@ -12,7 +12,7 @@ aliases:
- /influxdb/v2/introduction/getting_started/ - /influxdb/v2/introduction/getting_started/
- /influxdb/v2/introduction/getting_started/ - /influxdb/v2/introduction/getting_started/
- /influxdb/v2/introduction/getting_started/ - /influxdb/v2/introduction/getting_started/
- /influxdb/latest/introduction/getting-started/ - /influxdb/v2/introduction/getting-started/
menu: menu:
influxdb_v1: influxdb_v1:

View File

@ -7,7 +7,7 @@ menu:
weight: 70 weight: 70
identifier: InfluxQL identifier: InfluxQL
aliases: aliases:
- /influxdb/latest/query_language/_index - /influxdb/v2/query_language/_index
--- ---
This section introduces InfluxQL, the InfluxDB SQL-like query language for This section introduces InfluxQL, the InfluxDB SQL-like query language for

View File

@ -12,7 +12,7 @@ aliases:
- /influxdb/v2/query_language/spec/ - /influxdb/v2/query_language/spec/
- /influxdb/v2/query_language/spec/ - /influxdb/v2/query_language/spec/
- /influxdb/v2/query_language/spec/ - /influxdb/v2/query_language/spec/
- /influxdb/latest/query_language/spec/ - /influxdb/v2/query_language/spec/
--- ---
## Introduction ## Introduction
@ -234,12 +234,13 @@ regex_lit = "/" { unicode_char } "/" .
`=~` matches against `=~` matches against
`!~` doesn't match against `!~` doesn't match against
> **Note:** InfluxQL supports using regular expressions when specifying: > [!Note]
> InfluxQL supports using regular expressions when specifying:
> >
* [field keys](/influxdb/v1/concepts/glossary/#field-key) and [tag keys](/influxdb/v1/concepts/glossary/#tag-key) in the [`SELECT` clause](/influxdb/v1/query_language/explore-data/#the-basic-select-statement) > * [field keys](/influxdb/v1/concepts/glossary/#field-key) and [tag keys](/influxdb/v1/concepts/glossary/#tag-key) in the [`SELECT` clause](/influxdb/v1/query_language/explore-data/#the-basic-select-statement)
* [measurements](/influxdb/v1/concepts/glossary/#measurement) in the [`FROM` clause](/influxdb/v1/query_language/explore-data/#the-basic-select-statement) > * [measurements](/influxdb/v1/concepts/glossary/#measurement) in the [`FROM` clause](/influxdb/v1/query_language/explore-data/#the-basic-select-statement)
* [tag values](/influxdb/v1/concepts/glossary/#tag-value) and string [field values](/influxdb/v1/concepts/glossary/#field-value) in the [`WHERE` clause](/influxdb/v1/query_language/explore-data/#the-where-clause). > * [tag values](/influxdb/v1/concepts/glossary/#tag-value) and string [field values](/influxdb/v1/concepts/glossary/#field-value) in the [`WHERE` clause](/influxdb/v1/query_language/explore-data/#the-where-clause).
* [tag keys](/influxdb/v1/concepts/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v1/query_language/explore-data/#group-by-tags) > * [tag keys](/influxdb/v1/concepts/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v1/query_language/explore-data/#group-by-tags)
> >
>Currently, InfluxQL does not support using regular expressions to match >Currently, InfluxQL does not support using regular expressions to match
>non-string field values in the >non-string field values in the

View File

@ -20,7 +20,7 @@ including buckets, organizations, users, tasks, etc.
{{% oss-only %}} {{% oss-only %}}
{{% note %}} {{% note %}}
#### InfluxDB OSS and influx CLI versions #### InfluxDB OSS v2 and influx CLI versions
Beginning with **InfluxDB 2.1**, the `influx` CLI is packaged and versioned separately Beginning with **InfluxDB 2.1**, the `influx` CLI is packaged and versioned separately
from InfluxDB. from InfluxDB.
InfluxDB and `influx` CLI versions may differ, but compatibility is noted for each command. InfluxDB and `influx` CLI versions may differ, but compatibility is noted for each command.
@ -69,6 +69,8 @@ Do one of the following:
- [Manually download and install](#manually-download-and-install) - [Manually download and install](#manually-download-and-install)
### Use Homebrew ### Use Homebrew
<!--pytest.mark.skip-->
```sh ```sh
brew install influxdb-cli brew install influxdb-cli
``` ```
@ -80,6 +82,7 @@ If you used Homebrew to install **InfluxDB {{< current-version >}}**, the `influ
formula was downloaded as a dependency and should already be installed. formula was downloaded as a dependency and should already be installed.
If installed, `influxdb-cli` will appear in the output of the following command: If installed, `influxdb-cli` will appear in the output of the following command:
<!--pytest.mark.skip-->
```sh ```sh
brew list | grep influxdb-cli brew list | grep influxdb-cli
``` ```
@ -93,6 +96,13 @@ brew list | grep influxdb-cli
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz" download>influx CLI v{{< latest-patch cli=true >}} (macOS)</a> <a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz" download>influx CLI v{{< latest-patch cli=true >}} (macOS)</a>
<!--test:previous
```sh
curl -s -o ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz \
https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz
```
-->
2. **Unpackage the downloaded package.** 2. **Unpackage the downloaded package.**
Do one of the following: Do one of the following:
@ -101,6 +111,7 @@ brew list | grep influxdb-cli
- Run the following command in a macOS command prompt application such - Run the following command in a macOS command prompt application such
**Terminal** or **[iTerm2](https://www.iterm2.com/)**: **Terminal** or **[iTerm2](https://www.iterm2.com/)**:
<!--pytest-codeblocks:cont-->
```sh ```sh
# Unpackage contents to the current working directory # Unpackage contents to the current working directory
tar zxvf ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz tar zxvf ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz
@ -108,6 +119,7 @@ brew list | grep influxdb-cli
3. **(Optional) Place the binary in your `$PATH`.** 3. **(Optional) Place the binary in your `$PATH`.**
<!--pytest.mark.skip-->
```sh ```sh
# (Optional) Copy the influx binary to your $PATH # (Optional) Copy the influx binary to your $PATH
sudo cp ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64/influx /usr/local/bin/ sudo cp ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64/influx /usr/local/bin/
@ -145,34 +157,40 @@ brew list | grep influxdb-cli
#### Download from the command line #### Download from the command line
```sh ```bash
# amd64 # amd64
wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz curl -O \
https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
# arm
wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
``` ```
4. **Unpackage the downloaded package.** <!--python-codeblocks:cont-->
```bash
# arm
curl -O \
https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz \
```
2. **Unpackage the downloaded package.**
_**Note:** The following commands are examples. Adjust the filenames, paths, and utilities if necessary._ _**Note:** The following commands are examples. Adjust the filenames, paths, and utilities if necessary._
```sh <!--python-codeblocks:cont-->
```bash
# amd64 # amd64
tar xvzf path/to/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz tar xvzf influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
```
<!--python-codeblocks:cont-->
```bash
# arm # arm
tar xvzf path/to/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz tar xvzf influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
``` ```
3. **(Optional) Place the unpackaged `influx` executable in your system `$PATH`.** 3. **(Optional) Place the unpackaged `influx` executable in your system `$PATH`.**
```sh <!--python-codeblocks:cont-->
# amd64 ```bash
sudo cp influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64/influx /usr/local/bin/ sudo cp ./influx /usr/local/bin/
# arm
sudo cp influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64/influx /usr/local/bin/
``` ```
If you do not move the `influx` binary into your `$PATH`, prefix the executable If you do not move the `influx` binary into your `$PATH`, prefix the executable
@ -185,7 +203,9 @@ brew list | grep influxdb-cli
{{% tab-content %}} {{% tab-content %}}
{{% note %}} {{% note %}}
We recommend running `influx` CLI commands in Powershell. #### Use Powershell for Windows
Use Powershell for running `influx` CLI commands.
Command Prompt is not fully compatible. Command Prompt is not fully compatible.
{{% /note %}} {{% /note %}}
@ -229,10 +249,10 @@ Use the [`influx config create` command](/influxdb/v2/reference/cli/influx/confi
to create an `influx` CLI config and set it as active: to create an `influx` CLI config and set it as active:
```sh ```sh
influx config create --config-name <config-name> \ influx config create --config-name CONFIG_NAME \
--host-url http://localhost:8086 \ --host-url http://localhost:8086 \
--org <your-org> \ --org ORG_NAME \
--token <your-auth-token> \ --token API_TOKEN \
--active --active
``` ```
@ -241,13 +261,15 @@ For more information about managing CLI configurations, see the
### Credential precedence ### Credential precedence
There are three ways to provide the necessary credentials to the `influx` CLI, Provide credentials using any of the following supported methods.
which uses the following precedence when retrieving credentials: The `influx` CLI uses the following precedence when retrieving credentials:
1. Command line flags (`--host`, `--org -o`, `--token -t`) 1. Command line flags (`--host`, `--org -o`, `--token -t`)
2. Environment variables (`INFLUX_HOST`, `INFLUX_ORG`, `INFLUX_TOKEN`) 2. Environment variables (`INFLUX_HOST`, `INFLUX_ORG`, `INFLUX_TOKEN`)
3. CLI configuration file 3. CLI configuration file
Command line flags override environment variables, which override configuration file values.
## Usage ## Usage
``` ```

View File

@ -12,7 +12,7 @@ updated_in: CLI 2.5.0
The `influx auth create` command creates an API token in InfluxDB. The `influx auth create` command creates an API token in InfluxDB.
{{% warn %}} {{% warn %}}
**Issue resolved**: Using influx CLI 2.4 prevented you from creating an **all-access** or **operator** token using the `influx auth create` command. This issue is resolved in the influx 2.5 CLI release. Please [upgrade to the latest version](/influxdb/latest/tools/influx-cli/) of the influx cli. **Issue resolved**: Using influx CLI 2.4 prevented you from creating an **all-access** or **operator** token using the `influx auth create` command. This issue is resolved in the influx 2.5 CLI release. Please [upgrade to the latest version](/influxdb/v2/tools/influx-cli/) of the influx cli.
{{% /warn %}} {{% /warn %}}
## Usage ## Usage

View File

@ -1,7 +1,7 @@
--- ---
title: API Invokable Scripts title: API Invokable Scripts
description: > description: >
InfluxDB lets you [invoke scripts](/influxdb/cloud/api-guide/api-invokable-scripts/) using the InfluxDB APIs ([InfluxDB Cloud API](/influxdb/cloud/api/) and [InfluxDB OSS (open source) API](/influxdb/latest/api/)). Here, Jay Clifford explains how to use this feature with custom endpoints to improve the functionality, efficiency, and security of your applications. InfluxDB lets you [invoke scripts](/influxdb/cloud/api-guide/api-invokable-scripts/) using the InfluxDB APIs ([InfluxDB Cloud API](/influxdb/cloud/api/) and [InfluxDB OSS (open source) API](/influxdb/v2/api/)). Here, Jay Clifford explains how to use this feature with custom endpoints to improve the functionality, efficiency, and security of your applications.
menu: menu:
resources: resources:
parent: Videos parent: Videos

View File

@ -1,7 +1,7 @@
--- ---
title: Intro to Client Libraries title: Intro to Client Libraries
description: > description: >
[Client libraries](/influxdb/latest/api-guide/client-libraries/) are a powerful way to harness the power of InfluxDB's API using familiar programming languages. Here, Jay Clifford explains what client libraries are, how they work, and why you should use them when working with InfluxDB. [Client libraries](/influxdb/v2/api-guide/client-libraries/) are a powerful way to harness the power of InfluxDB's API using familiar programming languages. Here, Jay Clifford explains what client libraries are, how they work, and why you should use them when working with InfluxDB.
menu: menu:
resources: resources:
parent: Videos parent: Videos

View File

@ -1,7 +1,7 @@
--- ---
title: Optimizing Flux Functions title: Optimizing Flux Functions
description: > description: >
Flux queries are scripts that let you work with your data in InfluxDB. Here, Scott Anderson provides some tips for [optimizing Flux queries](/influxdb/latest/query-data/optimize-queries/), so that your data and applications are more performant. Flux queries are scripts that let you work with your data in InfluxDB. Here, Scott Anderson provides some tips for [optimizing Flux queries](/influxdb/v2/query-data/optimize-queries/), so that your data and applications are more performant.
menu: menu:
resources: resources:
parent: Videos parent: Videos

View File

@ -1,8 +1,7 @@
The InfluxDB HTTP API provides a programmatic interface for interactions with The InfluxDB HTTP API provides a programmatic interface for interactions with
{{% product-name %}}, such as writing and querying data, triggering Processing {{% product-name %}}, such as writing and querying data, triggering Processing
engine plugins, and managing an InfluxDB 3 instance. engine plugins, and managing an InfluxDB 3 instance.
The API includes endpoints for backward compatibility with
The InfluxDB 3 HTTP API includes endpoints for backward compatibility with
InfluxDB v1 and v2 workloads, clients, and third-party tools. InfluxDB v1 and v2 workloads, clients, and third-party tools.
<a class="btn" href="/influxdb3/core/api/v3/">InfluxDB 3 HTTP API for {{% product-name %}}</a> <a class="btn" href="/influxdb3/{{% product-key %}}/api/v3/">{{% product-name %}} HTTP API</a>

View File

@ -98,6 +98,8 @@ function substitute_placeholders {
s|NUMBER_OF_DAYS|365|g; s|NUMBER_OF_DAYS|365|g;
s|@path/to/line-protocol.txt|data/home-sensor-data.lp|g; s|@path/to/line-protocol.txt|data/home-sensor-data.lp|g;
s|/path/to/custom/assets-dir|/app/custom-assets|g; s|/path/to/custom/assets-dir|/app/custom-assets|g;
s|/path/to/TEMPLATE_FILE.yml|/root/influxdb-templates/TEMPLATE_FILE.yml|g;
s|/path/to/TEMPLATE_FILE.json|/root/influxdb-templates/TEMPLATE_FILE.json|g;
' $file ' $file
# v2-specific replacements. # v2-specific replacements.

View File

@ -51,6 +51,7 @@ setup
if [[ $runner == "pytest" ]]; then if [[ $runner == "pytest" ]]; then
pytest \ pytest \
-ra \
-s \ -s \
--codeblocks \ --codeblocks \
--suppress-no-test-exit-code \ --suppress-no-test-exit-code \