@@ -35,7 +35,8 @@ Include the following parameters:
35
35
The following example sends an HTTP ` GET ` request with a URL-encoded SQL query:
36
36
37
37
``` bash
38
- curl -v " http://{{< influxdb/host >}}/api/v3/query_sql?db=servers&q=select+*+from+cpu+limit+5"
38
+ curl " http://{{< influxdb/host >}}/api/v3/query_sql?db=servers&q=select+*+from+cpu+limit+5" \
39
+ --header " Authorization: Bearer AUTH_TOKEN"
39
40
```
40
41
41
42
### Example: Query passing JSON parameters
@@ -44,7 +45,8 @@ The following example sends an HTTP `POST` request with parameters in a JSON pay
44
45
45
46
``` bash
46
47
curl http://{{< influxdb/host > }}/api/v3/query_sql \
47
- --data ' {"db": "server", "q": "select * from cpu limit 5"}'
48
+ --header " Authorization: Bearer AUTH_TOKEN"
49
+ --json ' {"db": "server", "q": "select * from cpu limit 5"}'
48
50
```
49
51
50
52
### Query system information
@@ -71,7 +73,8 @@ tables (`"table_schema":"iox"`), system tables, and information schema tables
71
73
for a database:
72
74
73
75
``` bash
74
- curl " http://{{< influxdb/host >}}/api/v3/query_sql?db=mydb&format=jsonl&q=show%20tables"
76
+ curl " http://{{< influxdb/host >}}/api/v3/query_sql?db=mydb&format=jsonl&q=show%20tables" \
77
+ --header " Authorization: Bearer AUTH_TOKEN"
75
78
```
76
79
77
80
The response body contains the following JSONL:
@@ -117,7 +120,7 @@ that surround field names._
117
120
118
121
``` bash
119
122
curl " http://localhost:8181/api/v3/query_sql" \
120
- --header " Content-Type: application/json " \
123
+ --header " Authorization: Bearer AUTH_TOKEN " \
121
124
--json ' {
122
125
"db": "mydb",
123
126
"q": "SELECT * FROM information_schema.columns WHERE table_schema = ' " 'iox'" ' AND table_name = ' " 'system_swap'" ' ",
@@ -144,7 +147,7 @@ To view recently executed queries, query the `queries` system table:
144
147
145
148
``` bash
146
149
curl " http://localhost:8181/api/v3/query_sql" \
147
- --header " Content-Type: application/json " \
150
+ --header " Authorization: Bearer AUTH_TOKEN " \
148
151
--json ' {
149
152
"db": "mydb",
150
153
"q": "SELECT * FROM system.queries LIMIT 2",
@@ -180,7 +183,8 @@ Include the following parameters:
180
183
The following example sends an HTTP ` GET ` request with a URL-encoded InfluxQL query:
181
184
182
185
``` bash
183
- curl -v " http://{{< influxdb/host >}}/api/v3/query_influxql?db=servers&q=select+*+from+cpu+limit+5"
186
+ curl " http://{{< influxdb/host >}}/api/v3/query_influxql?db=servers&q=select+*+from+cpu+limit+5" \
187
+ --header " Authorization: Bearer AUTH_TOKEN"
184
188
```
185
189
186
190
### Example: Query passing JSON parameters
@@ -189,5 +193,6 @@ The following example sends an HTTP `POST` request with parameters in a JSON pay
189
193
190
194
``` bash
191
195
curl http://{{< influxdb/host > }}/api/v3/query_influxql \
192
- --data ' {"db": "server", "q": "select * from cpu limit 5"}'
196
+ --header " Authorization: Bearer AUTH_TOKEN" \
197
+ --json ' {"db": "server", "q": "select * from cpu limit 5"}'
193
198
```
0 commit comments