Skip to content

Commit 28b2241

Browse files
authored
Merge branch 'master' into jts-qol-influxdb3-release-helper-scripts
2 parents 2b3c3fc + e339b70 commit 28b2241

File tree

23 files changed

+583
-247
lines changed

23 files changed

+583
-247
lines changed

api-docs/influxdb/v2/.config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@ apis:
1010
root: v2/ref.yml
1111
x-influxdata-docs-aliases:
1212
- /influxdb/v2/api/
13-
v1-compatibility@2:
14-
root: v1-compatibility/swaggerV1Compat.yml
15-
x-influxdata-docs-aliases:
13+
- /influxdb/v2/api/v1-compatibility/
1614
- /influxdb/v2/api/v1/

api-docs/influxdb/v2/v2/content/tag-groups.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
- Headers
77
- Pagination
88
- Response codes
9+
- Compatibility endpoints
910
- name: All endpoints
1011
tags: []

api-docs/influxdb/v2/v2/ref.yml

Lines changed: 233 additions & 107 deletions
Large diffs are not rendered by default.

content/influxdb/v2/api-guide/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ and visit the `/docs` endpoint in a browser ([localhost:8086/docs](http://localh
3434

3535
## InfluxDB v1 compatibility API documentation
3636

37-
The InfluxDB v2 API includes [InfluxDB 1.x compatibility endpoints](/influxdb/v2/reference/api/influxdb-1x/)
37+
The InfluxDB v2 API includes [InfluxDB v1 compatibility endpoints and authentication](/influxdb/v2/api-guide/influxdb-1x/)
3838
that work with InfluxDB 1.x client libraries and third-party integrations like
3939
[Grafana](https://grafana.com) and others.
4040

41-
<a class="btn" href="/influxdb/v2/api/v1-compatibility/">View full v1 compatibility API documentation</a>
41+
<a class="btn" href="/influxdb/v2/api/v2/#tag/Compatibility-endpoints">View full v1 compatibility API documentation</a>

content/influxdb/v2/api-guide/api_intro.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ source: /shared/influxdb-v2/api-guide/api_intro.md
1414
---
1515

1616
<!-- The content for this file is located at
17-
// SOURCE content/shared/influxdb-v2/api-guide/api_intro.md -->
17+
// SOURCE content/shared/influxdb-v2/api-guide/api_intro.md
18+
-->

content/influxdb/v2/api-guide/influxdb-1x/_index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ source: /shared/influxdb-v2/api-guide/influxdb-1x/_index.md
1818
---
1919

2020
<!-- The content for this file is located at
21-
// SOURCE content/shared/influxdb-v2/api-guide/influxdb-1x/_index.md -->
21+
// SOURCE content/shared/influxdb-v2/api-guide/influxdb-1x/_index.md
22+
-->

content/influxdb/v2/api-guide/influxdb-1x/query.md

Lines changed: 74 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,48 @@ list_code_example: |
1414
<span class="api get">GET</span> http://localhost:8086/query
1515
</pre>
1616
related:
17+
- /influxdb/v2/query-data/execute-queries/influx-api/
1718
- /influxdb/v2/query-data/influxql
1819
aliases:
1920
- /influxdb/v2/reference/api/influxdb-1x/query/
2021
---
2122

2223
The `/query` 1.x compatibility endpoint queries InfluxDB {{< current-version >}} using **InfluxQL**.
23-
Use the `GET` request method to query data from the `/query` endpoint.
24+
Send an InfluxQL query in an HTTP `GET` or `POST` request to query data from the `/query` endpoint.
2425

25-
<pre>
26-
<span class="api get">GET</span> http://localhost:8086/query
27-
</pre>
2826

2927
The `/query` compatibility endpoint uses the **database** and **retention policy**
3028
specified in the query request to map the request to an InfluxDB bucket.
3129
For more information, see [Database and retention policy mapping](/influxdb/v2/reference/api/influxdb-1x/dbrp).
3230

3331
{{% show-in "cloud,cloud-serverless" %}}
3432

35-
{{% note %}}
36-
If you have an existing bucket that doesn't follow the **database/retention-policy** naming convention,
37-
you **must** [manually create a database and retention policy mapping](/influxdb/v2/query-data/influxql/dbrp/#create-dbrp-mappings)
38-
to query that bucket with the `/query` compatibility API.
39-
{{% /note %}}
33+
> [!Note]
34+
> If you have an existing bucket that doesn't follow the **database/retention-policy** naming convention,
35+
> you **must** [manually create a database and retention policy mapping](/influxdb/v2/query-data/influxql/dbrp/#create-dbrp-mappings)
36+
> to query that bucket with the `/query` compatibility API.
4037
4138
{{% /show-in %}}
4239

4340
## Authentication
4441

4542
Use one of the following authentication methods:
46-
* **token authentication**
47-
* **basic authentication with username and password**
48-
* **query string authentication with username and password**
4943

50-
_For more information, see [Authentication](/influxdb/v2/reference/api/influxdb-1x/#authentication)._
44+
- the 2.x `Authorization: Token` scheme in the header
45+
- the v1-compatible `u` and `p` query string parameters
46+
- the v1-compatible `Basic` authentication scheme in the header
47+
48+
For more information, see [Authentication for the 1.x compatibility API](/influxdb/v2/api-guide/influxdb-1x/).
5149

5250
## Query string parameters
5351

5452
### u
5553
(Optional) The 1.x **username** to authenticate the request.
54+
If you provide an API token as the password, `u` is required, but can be any value.
5655
_See [query string authentication](/influxdb/v2/reference/api/influxdb-1x/#query-string-authentication)._
5756

5857
### p
59-
(Optional) The 1.x **password** to authenticate the request.
58+
(Optional) The 1.x **password** or the 2.x API token to authenticate the request.
6059
_See [query string authentication](/influxdb/v2/reference/api/influxdb-1x/#query-string-authentication)._
6160

6261
### db
@@ -94,61 +93,65 @@ The following precisions are available:
9493
- [Return query results with millisecond Unix timestamps](#return-query-results-with-millisecond-unix-timestamps)
9594
- [Execute InfluxQL queries from a file](#execute-influxql-queries-from-a-file)
9695

97-
{{% code-placeholders "API_TOKEN" %}}
96+
{{% code-placeholders "INFLUX_USERNAME|INFLUX_PASSWORD_OR_TOKEN|API_TOKEN" %}}
9897

9998
##### Query using basic authentication
10099

101-
{{% show-in "v2" %}}
100+
The following example:
102101

103-
{{< code-tabs-wrapper >}}
104-
{{% code-tabs %}}
105-
[curl](#curl)
106-
[Node.js](#nodejs)
107-
{{% /code-tabs %}}
108-
{{% code-tab-content %}}
102+
- sends a `GET` request to the `/query` endpoint
103+
- uses the `Authorization` header with the `Basic` scheme (compatible with InfluxDB 1.x) to provide username and password credentials
104+
- uses the default retention policy for the database
109105

106+
{{% show-in "v2" %}}
110107
<!--pytest.mark.skip-->
111108

112109
```sh
113-
{{% get-shared-text "api/v1-compat/auth/oss/basic-auth.sh" %}}
110+
##############################################################################
111+
# Use Basic authentication with an
112+
# InfluxDB v1-compatible username and password
113+
# to query the InfluxDB 1.x compatibility API.
114+
#
115+
# INFLUX_USERNAME: your v1-compatible username.
116+
# INFLUX_PASSWORD_OR_TOKEN: your API token or v1-compatible password.
117+
##############################################################################
118+
119+
curl --get "http://{{< influxdb/host >}}/query" \
120+
--user "INFLUX_USERNAME":"INFLUX_PASSWORD_OR_TOKEN" \
121+
--data-urlencode "db=BUCKET_NAME" \
122+
--data-urlencode "q=SELECT * FROM cpu_usage"
114123
```
115-
{{% /code-tab-content %}}
116-
{{% code-tab-content %}}
117-
```js
118-
{{% get-shared-text "api/v1-compat/auth/oss/basic-auth.js" %}}
119-
```
120-
{{% /code-tab-content %}}
121-
{{< /code-tabs-wrapper >}}
122-
123124
{{% /show-in %}}
124125

125126
{{% show-in "cloud,cloud-serverless" %}}
126127

127-
{{< code-tabs-wrapper >}}
128-
{{% code-tabs %}}
129-
[curl](#curl)
130-
[Node.js](#nodejs)
131-
{{% /code-tabs %}}
132-
{{% code-tab-content %}}
133-
134128
<!--pytest.mark.skip-->
135129

136130
```sh
137131
{{% get-shared-text "api/v1-compat/auth/cloud/basic-auth.sh" %}}
138132
```
139-
{{% /code-tab-content %}}
140-
{{% code-tab-content %}}
141-
```js
142-
{{% get-shared-text "api/v1-compat/auth/cloud/basic-auth.js" %}}
143-
```
144-
{{% /code-tab-content %}}
145-
{{< /code-tabs-wrapper >}}
146-
147133

148134
{{% /show-in %}}
149135

136+
##### Query using an HTTP POST request
137+
138+
```bash
139+
curl \
140+
--request POST \
141+
"http://{{< influxdb/host >}}/query?db=DATABASE_NAME&rp=RETENTION_POLICY" \
142+
--user "INFLUX_USERNAME":"INFLUX_PASSWORD_OR_TOKEN" \
143+
--header "Content-type: application/vnd.influxql" \
144+
--data "SELECT * FROM cpu_usage WHERE time > now() - 1h"
145+
```
146+
150147
##### Query a non-default retention policy
151148

149+
The following example:
150+
151+
- sends a `GET` request to the `/query` endpoint
152+
- uses the `Authorization` header with the `Token` scheme (compatible with InfluxDB 2.x) to provide the API token
153+
- queries a custom retention policy mapped for the database
154+
152155
<!--test:setup
153156
```sh
154157
service influxdb start && \
@@ -162,43 +165,56 @@ influx setup \
162165
-->
163166

164167
```sh
165-
curl --get http://localhost:8086/query \
168+
curl --get http://{{< influxdb/host >}}/query \
166169
--header "Authorization: Token API_TOKEN" \
167-
--data-urlencode "db=mydb" \
168-
--data-urlencode "rp=customrp" \
170+
--data-urlencode "db=DATABASE_NAME" \
171+
--data-urlencode "rp=RETENTION_POLICY_NAME" \
169172
--data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1"
170173
```
171174

172175
##### Execute multiple queries
173176

174177
```sh
175-
curl --get http://localhost:8086/query \
178+
curl --get http://{{< influxdb/host >}}/query \
176179
--header "Authorization: Token API_TOKEN" \
177-
--data-urlencode "db=mydb" \
180+
--data-urlencode "db=DATABASE_NAME" \
178181
--data-urlencode "q=SELECT * FROM mem WHERE host=host1;SELECT mean(used_percent) FROM mem WHERE host=host1 GROUP BY time(10m)"
179182
```
180183

181184
##### Return query results with millisecond Unix timestamps
182185
```sh
183-
curl --get http://localhost:8086/query \
186+
curl --get http://{{< influxdb/host >}}/query \
184187
--header "Authorization: Token API_TOKEN" \
185-
--data-urlencode "db=mydb" \
186-
--data-urlencode "rp=myrp" \
188+
--data-urlencode "db=DATABASE_NAME" \
189+
--data-urlencode "rp=RETENTION_POLICY_NAME" \
187190
--data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1" \
188191
--data-urlencode "epoch=ms"
189192
```
190193

191194
##### Execute InfluxQL queries from a file
192195
```sh
193-
curl --get http://localhost:8086/query \
196+
curl --get http://{{< influxdb/host >}}/query \
194197
--header "Authorization: Token API_TOKEN" \
195-
--data-urlencode "db=mydb" \
196-
--data-urlencode "q@path/to/influxql.txt" \
197-
--data-urlencode "async=true"
198+
--data-urlencode "db=DATABASE_NAME" \
199+
--data-urlencode "q@path/to/influxql.txt"
198200
```
199201

202+
##### Return a gzip-compressed response
203+
```sh
204+
curl --get http://{{< influxdb/host >}}/query \
205+
--header 'Accept-Encoding: gzip' \
206+
--header "Authorization: Token API_TOKEN" \
207+
--data-urlencode "db=DATABASE_NAME" \
208+
--data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1"
209+
```
200210
{{% /code-placeholders %}}
201211

202212
Replace the following:
203213

204214
- {{% code-placeholder-key %}}`API_TOKEN`{{% /code-placeholder-key %}}: your InfluxDB [API token](/influxdb/v2/admin/tokens/)
215+
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: the name of the database to query.
216+
In InfluxDB 2.x, databases and retention policies map to [buckets](/influxdb/v2/admin/buckets/).
217+
- {{% code-placeholder-key %}}`RETENTION_POLICY_NAME`{{% /code-placeholder-key %}}: the name of the retention policy to query.
218+
In InfluxDB 2.x, databases and retention policies map to [buckets](/influxdb/v2/admin/buckets/).
219+
220+
_For more information about the database and retention policy mapping, see [Database and retention policy mapping](/influxdb/v2/reference/api/influxdb-1x/dbrp)._

content/influxdb/v2/api-guide/tutorials/_index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ source: /shared/influxdb-v2/api-guide/tutorials/_index.md
1212
---
1313

1414
<!-- The content for this file is located at
15-
// SOURCE content/shared/influxdb-v2/api-guide/tutorials/_index.md -->
15+
// SOURCE content/shared/influxdb-v2/api-guide/tutorials/_index.md
16+
-->

content/influxdb/v2/install/upgrade/v1-to-v2/automatic-upgrade.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,6 @@ which requires authentication.
328328

329329
**For these external clients to work with InfluxDB {{< current-version >}}:**
330330

331-
1. [Manually create a 1.x-compatible authorization](/influxdb/v2/upgrade/v1-to-v2/manual-upgrade/#create-a-1x-compatible-authorization).
331+
1. [Manually create a v1-compatible authorization](/influxdb/v2/upgrade/v1-to-v2/manual-upgrade/#create-a-1x-compatible-authorization).
332332
2. Update the client configuration to use the username and password associated
333-
with your 1.x-compatible authorization.
333+
with your v1-compatible authorization.

content/influxdb/v2/install/upgrade/v1-to-v2/manual-upgrade.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Manually upgrade from InfluxDB 1.x to 2.7
33
list_title: Manually upgrade from 1.x to 2.7
44
description: >
55
To manually upgrade from InfluxDB 1.x to InfluxDB 2.7, migrate data, create
6-
1.x-compatible authorizations, and create database and retention policy
6+
v1-compatible authorizations, and create database and retention policy
77
(DBRP) mappings.
88
menu:
99
influxdb_v2:

0 commit comments

Comments
 (0)