Skip to content

Commit 3558b7c

Browse files
authored
Merge pull request #6274 from influxdata/docs/5625-v1-get-query-endpoint
Docs/5625 v1 get query endpoint
2 parents ae503f7 + 144de57 commit 3558b7c

File tree

3 files changed

+722
-4
lines changed

3 files changed

+722
-4
lines changed

api-docs/influxdb3/cloud-dedicated/v1-compatibility/swaggerV1Compat.yml

Lines changed: 248 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,22 @@ paths:
6666
schema:
6767
type: string
6868
required: true
69-
description: Bucket to write to. If none exists, InfluxDB creates a bucket with a default 3-day retention policy.
69+
description: |
70+
The database to write to.
71+
72+
**Database targeting:** In Cloud Dedicated, databases can be named using the `database_name/retention_policy_name` convention for InfluxQL compatibility. Cloud Dedicated does not use DBRP mappings. The db and rp parameters are used to construct the target database name following this naming convention.
73+
74+
**Auto-creation behavior:** Cloud Dedicated requires databases to be created before writing data. The v1 `/write` API does not automatically create databases. If the specified
75+
database does not exist, the write request will fail.
76+
77+
Authentication: Requires a valid API token with _write_ permissions for the target database.
78+
79+
### Related
80+
81+
- [Write data to InfluxDB Cloud Dedicated](/influxdb3/cloud-dedicated/write-data/)
82+
- [Manage databases in InfluxDB Cloud Dedicated](/influxdb3/cloud-dedicated/admin/databases/)
83+
- [InfluxQL DBRP naming convention](/influxdb3/cloud-dedicated/admin/databases/create/#influxql-dbrp-naming-convention)
84+
- [InfluxQL data retention policy mapping differences](/influxdb3/cloud-serverless/guides/prototype-evaluation/#influxql-data-retention-policy-mapping-differences)
7085
- in: query
7186
name: rp
7287
schema:
@@ -137,6 +152,160 @@ paths:
137152
schema:
138153
$ref: '#/components/schemas/Error'
139154
/query:
155+
get:
156+
operationId: GetQueryV1
157+
tags:
158+
- Query
159+
summary: Query using the InfluxDB v1 HTTP API
160+
parameters:
161+
- $ref: '#/components/parameters/TraceSpan'
162+
- $ref: '#/components/parameters/AuthUserV1'
163+
- $ref: '#/components/parameters/AuthPassV1'
164+
- in: header
165+
name: Accept
166+
schema:
167+
type: string
168+
description: Specifies how query results should be encoded in the response. **Note:** With `application/csv`, query results include epoch timestamps instead of RFC3339 timestamps.
169+
default: application/json
170+
enum:
171+
- application/json
172+
- application/csv
173+
- text/csv
174+
- application/x-msgpack
175+
- in: header
176+
name: Accept-Encoding
177+
description: The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand.
178+
schema:
179+
type: string
180+
description: Specifies that the query response in the body should be encoded with gzip or not encoded with identity.
181+
default: identity
182+
enum:
183+
- gzip
184+
- identity
185+
- in: query
186+
name: chunked
187+
description: |
188+
If true, the response is divided into chunks of size `chunk_size`.
189+
schema:
190+
type: boolean
191+
default: false
192+
- in: query
193+
name: chunk_size
194+
description: |
195+
The number of records that will go into a chunk.
196+
This parameter is only used if `chunked=true`.
197+
schema:
198+
type: integer
199+
default: 10000
200+
- in: query
201+
name: db
202+
schema:
203+
type: string
204+
required: true
205+
description: The database to query from.
206+
- in: query
207+
name: pretty
208+
description: |
209+
If true, the JSON response is formatted in a human-readable format.
210+
schema:
211+
type: boolean
212+
default: false
213+
- in: query
214+
name: q
215+
description: Defines the InfluxQL query to run.
216+
required: true
217+
schema:
218+
type: string
219+
- in: query
220+
name: rp
221+
schema:
222+
type: string
223+
description: |
224+
The retention policy name for InfluxQL compatibility
225+
226+
Optional parameter that, when combined with the db parameter, forms the complete database name to query. In InfluxDB Cloud Dedicated, databases can be named using the
227+
database_name/retention_policy_name convention for InfluxQL compatibility.
228+
229+
When a request specifies both `db` and `rp`, Cloud Dedicated combines them as `db/rp` to target the database--for example:
230+
231+
- If `db=mydb` and `rp=autogen`, the query targets the database named `mydb/autogen`
232+
- If only `db=mydb` is provided (no `rp`), the query targets the database named `mydb`
233+
234+
Unlike InfluxDB v1 and Cloud Serverless, Cloud Dedicated does not use DBRP mappings or separate retention policy objects. This parameter exists solely for v1 API
235+
compatibility and database naming conventions.
236+
237+
_Note: The retention policy name does not control data retention in Cloud Dedicated. Data retention is determined by the database's **retention period** setting._
238+
239+
### Related
240+
241+
- [InfluxQL DBRP naming convention](/influxdb3/cloud-dedicated/admin/databases/create/#influxql-dbrp-naming-convention)
242+
- [InfluxQL data retention policy mapping differences](/influxdb3/cloud-serverless/guides/prototype-evaluation/#influxql-data-retention-policy-mapping-differences)
243+
- name: epoch
244+
description: |
245+
Formats timestamps as unix (epoch) timestamps with the specified precision
246+
instead of RFC3339 timestamps with nanosecond precision.
247+
in: query
248+
schema:
249+
type: string
250+
enum:
251+
- h
252+
- m
253+
- s
254+
- ms
255+
- u
256+
- µ
257+
- ns
258+
responses:
259+
'200':
260+
description: Query results
261+
headers:
262+
Content-Encoding:
263+
description: The Content-Encoding entity header is used to compress the media-type. When present, its value indicates which encodings were applied to the entity-body
264+
schema:
265+
type: string
266+
description: Specifies that the response in the body is encoded with gzip or not encoded with identity.
267+
default: identity
268+
enum:
269+
- gzip
270+
- identity
271+
Trace-Id:
272+
description: The Trace-Id header reports the request's trace ID, if one was generated.
273+
schema:
274+
type: string
275+
description: Specifies the request's trace ID.
276+
content:
277+
application/csv:
278+
schema:
279+
$ref: '#/components/schemas/InfluxQLCSVResponse'
280+
text/csv:
281+
schema:
282+
$ref: '#/components/schemas/InfluxQLCSVResponse'
283+
application/json:
284+
schema:
285+
$ref: '#/components/schemas/InfluxQLResponse'
286+
examples:
287+
influxql-chunk_size_2:
288+
value: |
289+
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag"],"values":[["2016-05-19T18:37:55Z",90,"1"],["2016-05-19T18:37:56Z",90,"1"]],"partial":true}],"partial":true}]}
290+
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag"],"values":[["2016-05-19T18:37:57Z",90,"1"],["2016-05-19T18:37:58Z",90,"1"]]}]}]}
291+
application/x-msgpack:
292+
schema:
293+
type: string
294+
format: binary
295+
'429':
296+
description: Token is temporarily over quota. The Retry-After header describes when to try the read again.
297+
headers:
298+
Retry-After:
299+
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
300+
schema:
301+
type: integer
302+
format: int32
303+
default:
304+
description: Error processing query
305+
content:
306+
application/json:
307+
schema:
308+
$ref: '#/components/schemas/Error'
140309
post:
141310
operationId: PostQueryV1
142311
tags:
@@ -148,6 +317,83 @@ paths:
148317
text/plain:
149318
schema:
150319
type: string
320+
application/json:
321+
schema:
322+
type: object
323+
properties:
324+
db:
325+
type: string
326+
description: |
327+
The database name for InfluxQL queries.
328+
329+
Required parameter that specifies the database to query.
330+
In InfluxDB Cloud Dedicated, this can be either:
331+
- A simple database name (for example, `mydb`)
332+
- The database portion of a `database_name/retention_policy_name` naming convention (used together with the `rp` parameter)
333+
334+
When used alone, `db` specifies the complete database name to query. When used with the `rp` parameter, they combine to form the full database name as `db/rp`--for example, if `db=mydb` and `rp=autogen`, the query targets the database named `mydb/autogen`.
335+
336+
Unlike InfluxDB Cloud Serverless, Cloud Dedicated does not use DBRP mappings. The database name directly corresponds to an existing database in your Cloud Dedicated cluster.
337+
338+
Examples:
339+
- `db=mydb` - queries the database named `mydb`
340+
- `db=mydb` with `rp=autogen` - queries the database named `mydb/autogen`
341+
342+
_Note: The specified database must exist in your Cloud Dedicated cluster. Queries will fail if the database does not exist._
343+
344+
### Related
345+
346+
- [InfluxQL DBRP naming convention](/influxdb3/cloud-dedicated/admin/databases/create/#influxql-dbrp-naming-convention)
347+
- [Migrate data from InfluxDB 1.x to Cloud Dedicated](/influxdb3/cloud-dedicated/guides/migrate-data/migrate-1x-to-cloud-dedicated/)
348+
- [InfluxQL data retention policy mapping differences between InfluxDB Cloud Dedicated and Cloud Serverless](/influxdb3/cloud-serverless/guides/prototype-evaluation/#influxql-data-retention-policy-mapping-differences)
349+
rp:
350+
description: |
351+
The retention policy name for InfluxQL compatibility
352+
353+
Optional parameter that, when combined with the db parameter, forms the complete database name to query. In InfluxDB Cloud Dedicated, databases can be named using the
354+
database_name/retention_policy_name convention for InfluxQL compatibility.
355+
356+
When a request specifies both `db` and `rp`, Cloud Dedicated combines them as `db/rp` to target the database--for example:
357+
358+
- If `db=mydb` and `rp=autogen`, the query targets the database named `mydb/autogen`
359+
- If only `db=mydb` is provided (no `rp`), the query targets the database named `mydb`
360+
361+
Unlike InfluxDB v1 and Cloud Serverless, Cloud Dedicated does not use DBRP mappings or separate retention policy objects. This parameter exists solely for v1 API
362+
compatibility and database naming conventions.
363+
364+
_Note: The retention policy name does not control data retention in Cloud Dedicated. Data retention is determined by the database's **retention period** setting._
365+
366+
### Related
367+
368+
- [InfluxQL DBRP naming convention](/influxdb3/cloud-dedicated/admin/databases/create/#influxql-dbrp-naming-convention)
369+
- [Migrate data from InfluxDB 1.x to Cloud Dedicated](/influxdb3/cloud-dedicated/guides/migrate-data/migrate-1x-to-cloud-dedicated/)
370+
- [InfluxQL data retention policy mapping differences](/influxdb3/cloud-serverless/guides/prototype-evaluation/#influxql-data-retention-policy-mapping-differences)
371+
type: string
372+
q:
373+
description: Defines the InfluxQL query to run.
374+
type: string
375+
chunked:
376+
description: |
377+
If true, the response is divided into chunks of size `chunk_size`.
378+
type: boolean
379+
chunk_size:
380+
description: |
381+
The number of records that will go into a chunk.
382+
This parameter is only used if `chunked=true`.
383+
type: integer
384+
default: 10000
385+
epoch:
386+
description: |
387+
A unix timestamp precision.
388+
type: string
389+
enum:
390+
- h
391+
- m
392+
- s
393+
- ms
394+
- u
395+
- µ
396+
- ns
151397
parameters:
152398
- $ref: '#/components/parameters/TraceSpan'
153399
- $ref: '#/components/parameters/AuthUserV1'
@@ -184,7 +430,7 @@ paths:
184430
schema:
185431
type: string
186432
required: true
187-
description: Bucket to query.
433+
description: Database to query.
188434
- in: query
189435
name: rp
190436
schema:

0 commit comments

Comments
 (0)