-
Notifications
You must be signed in to change notification settings - Fork 324
Expand file tree
/
Copy pathref.yml
More file actions
2139 lines (2009 loc) · 77.8 KB
/
ref.yml
File metadata and controls
2139 lines (2009 loc) · 77.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: InfluxDB v2 HTTP API for Cloud Dedicated
description: |
The InfluxDB v2 HTTP API lets you use `/api/v2` endpoints for managing retention policy mappings and writing data stored in an InfluxDB v3 instance.
This documentation is generated from the
[InfluxDB OpenAPI specification](https://raw.githubusercontent.com/influxdata/openapi/master/contracts/ref/cloud.yml).
license:
name: MIT
url: https://opensource.org/licenses/MIT
summary: The InfluxDB v2 HTTP API for InfluxDB Cloud Dedicated provides a v2-compatible programmatic interface for writing data stored in an InfluxDB Cloud Dedicated database.
version: ''
servers:
- url: /
security:
- BearerAuthentication: []
- TokenAuthentication: []
- BasicAuthentication: []
- QuerystringAuthentication: []
tags:
- description: |
### Write data
InfluxDB Cloud Dedicated provides the following HTTP API endpoints for writing data:
- **Recommended**: [`/api/v2/write` endpoint](#operation/PostWrite) for new write workloads or for bringing existing InfluxDB v2 write workloads to v3.
- [`/write` endpoint](#operation/PostLegacyWrite) for bringing existing InfluxDB v1 write workloads to v3.
Both endpoints accept the same line protocol format and process data in the same way.
### Query data
InfluxDB Cloud Dedicated provides the following protocols for executing a query:
- **Recommended**: _Flight+gRPC_ request that contains an SQL or InfluxQL query. See how to [get started querying InfluxDB using Flight and SQL](/influxdb/cloud-dedicated/get-started/query/).
- HTTP API [`/query` request](#operation/GetLegacyQuery) that contains an InfluxQL query.
Use this protocol when bringing existing InfluxDB v1 query workloads to v3.
### InfluxDB v2 compatibility
The HTTP API [`/api/v2/write` endpoint](#operation/PostWrite) works with the [`Bearer`](#section/Authentication/BearerAuthentication) and [`Token`](#section/Authentication/TokenAuthentication) authentication schemes and existing InfluxDB 2.x tools and code for [writing data](/influxdb/cloud-dedicated/write-data/).
See how to [use the InfluxDB v2 HTTP API with InfluxDB Cloud Dedicated](/influxdb/cloud-dedicated/guides/api-compatibility/v2/).
### InfluxDB v1 compatibility
The HTTP API [`/write` endpoint](#operation/PostLegacyWrite) and [`/query` endpoint](#operation/GetLegacyQuery) work with InfluxDB 1.x username/password [authentication schemes](#section/Authentication/) and existing InfluxDB 1.x tools and code.
See how to [use the InfluxDB v1 HTTP API with InfluxDB Cloud Dedicated](/influxdb/cloud-dedicated/guides/api-compatibility/v1/).
name: API compatibility
x-traitTag: true
- description: |
Use one of the following schemes to authenticate to the InfluxDB API:
- [Bearer authentication](#section/Authentication/BearerAuthentication)
- [Token authentication](#section/Authentication/TokenAuthentication)
- [Basic authentication](#section/Authentication/BasicAuthentication)
- [Querystring authentication](#section/Authentication/QuerystringAuthentication)
<!-- ReDoc-Inject: <security-definitions> -->
name: Authentication
x-traitTag: true
- description: |
To specify resources, some InfluxDB API endpoints require parameters or
properties in the request--for example,
writing to a `database` resource.
### Common parameters
| Query parameter | Value type | Description |
|:------------------------ |:--------------------- |:-------------------------------------------|
| `database`, `db` | string | The database name |
name: Common parameters
x-traitTag: true
- name: Data I/O endpoints
description: |
Write and query data stored in InfluxDB.
- description: |
InfluxDB HTTP API endpoints use standard HTTP request and response headers.
The following table shows common headers used by many InfluxDB API endpoints.
Some endpoints may use other headers that perform functions more specific to those endpoints--for example,
the `POST /api/v2/write` endpoint accepts the `Content-Encoding` header to indicate the compression applied to line protocol in the request body.
| Header | Value type | Description |
|:------------------------ |:--------------------- |:-------------------------------------------|
| `Accept` | string | The content type that the client can understand. |
| `Authorization` | string | The authorization scheme and credential. |
| `Content-Length` | integer | The size of the entity-body, in bytes, sent to the database. |
| `Content-Type` | string | The format of the data in the request body. |
name: Headers
x-traitTag: true
- name: Ping
- description: |
Query data stored in a database.
- HTTP clients can query the v1 [`/query` endpoint](#operation/GetLegacyQuery)
using **InfluxQL** and retrieve data in **CSV** or **JSON** format.
- The `/api/v2/query` endpoint can't query InfluxDB Cloud Dedicated.
- _Flight + gRPC_ clients can query using **SQL** or **InfluxQL** and retrieve data in **Arrow** format.
#### Related guides
- [Get started querying InfluxDB](/influxdb/cloud-dedicated/get-started/query/)
- [Execute queries](/influxdb/cloud-dedicated/query-data/execute-queries/)
name: Query
- description: |
See the [**Get Started**](/influxdb/cloud-dedicated/get-started/) tutorial
to get up and running authenticating with tokens, writing to databases, and querying data.
[**InfluxDB API client libraries and Flight clients**](/influxdb/cloud-dedicated/reference/client-libraries/)
are available to integrate InfluxDB APIs with your application.
name: Quick start
x-traitTag: true
- description: |
InfluxDB HTTP API endpoints use standard HTTP status codes for success and failure responses.
The response body may include additional details.
For details about a specific operation's response,
see **Responses** and **Response Samples** for that operation.
API operations may return the following HTTP status codes:
| Code | Status | Description |
|:-----------:|:------------------------ |:--------------------- |
| `200` | Success | |
| `201` | Created | One or more resources are created. The response body contains details about the resource. |
| `204` | No content | The request is successful and no data is returned. For example, The [`/write` and `/api/v2/write` endpoints](#tag/Write) return this status code if all data in the batch is written and queryable. |
| `400` | Bad request | InfluxDB can't parse the request due to an incorrect parameter or bad syntax. For _writes_, the error may indicate one of the following problems: <ul><li>[Rejected points](/influxdb/cloud-dedicated/write-data/troubleshoot/#troubleshoot-rejected-points)</li><li>`Authorization` header is missing or malformed or the API token doesn't have permission for the operation.</li></ul> |
| `401` | Unauthorized | May indicate one of the following: <ul><li>`Authorization: Token` header is missing or malformed</li><li>API token value is missing from the header</li><li>API token doesn't have permission. For more information about token types and permissions, see [Manage tokens](/influxdb/cloud-dedicated/admin/tokens/)</li></ul> |
| `404` | Not found | Requested resource was not found. `message` in the response body provides details about the requested resource. |
| `405` | Method not allowed | The API path doesn't support the HTTP method used in the request--for example, you send a `POST` request to an endpoint that only allows `GET`. |
| `422` | Unprocessable entity | Request data is invalid. `code` and `message` in the response body provide details about the problem. |
| `500` | Internal server error | |
| `503` | Service unavailable | Server is temporarily unavailable to process the request. The `Retry-After` header describes when to try the request again. |
name: Response codes
x-traitTag: true
- name: System information endpoints
- name: Usage
- description: |
Write time series data to [databases](/influxdb/cloud-dedicated/admin/databases/) using InfluxDB v1 or v2 endpoints.
name: Write
paths:
/ping:
get:
description: |
Reports the InfluxQL bridge querier health and the InfluxDB version of the instance.
The response is a HTTP `204` status code to inform you the querier is available.
For InfluxDB Cloud Dedicated, this endpoint only checks the status of queriers; doesn't check the status of ingesters.
To check the health of ingesters before writing data, send a request to one of the [write endpoints](/influxdb/cloud-dedicated/api/v2/#tag/Write).
This endpoint doesn't require authentication.
operationId: GetPing
responses:
'204':
description: |
Success--the querier is available.
Headers contain InfluxDB version information.
headers:
X-Influxdb-Build:
description: |
The type of InfluxDB build.
schema:
type: string
X-Influxdb-Version:
description: |
The version of InfluxDB.
schema:
type: integer
4xx:
description: |
#### InfluxDB Cloud
- Doesn't return this error.
security:
- {}
servers: []
summary: Get the status of the instance
tags:
- Ping
head:
description: |
Reports the InfluxQL bridge querier health and the InfluxDB version of the instance.
The response is a HTTP `204` status code to inform you the querier is available.
For InfluxDB Cloud Dedicated, this endpoint only checks the status of queriers; doesn't check the status of ingesters.
To check the health of ingesters before writing data, send a request to one of the [write endpoints](/influxdb/cloud-dedicated/api/v2/#tag/Write).
This endpoint doesn't require authentication.
operationId: HeadPing
responses:
'204':
description: |
Success--the querier is available.
Headers contain InfluxDB version information.
headers:
X-Influxdb-Build:
description: The type of InfluxDB build.
schema:
type: string
X-Influxdb-Version:
description: |
The version of InfluxDB.
schema:
type: integer
4xx:
description: |
#### InfluxDB Cloud
- Doesn't return this error.
security:
- {}
servers: []
summary: Get the status of the instance
tags:
- Ping
/api/v2/write:
post:
description: |
Writes data to a database.
Use this endpoint to send data in [line protocol](/influxdb/cloud-dedicated/reference/syntax/line-protocol/) format to InfluxDB.
InfluxDB Cloud Dedicated does the following when you send a write request:
1. Validates the request.
2. If successful, attempts to [ingest data](/influxdb/cloud-dedicated/reference/internals/durability/#data-ingest) from the request body; otherwise, responds with an [error status](/influxdb/cloud-dedicated/write-data/troubleshoot/#review-http-status-codes).
3. Ingests or rejects data in the batch and returns one of the following HTTP status codes:
- `204 No Content`: All data in the batch is ingested.
- `400 Bad Request`: Some (_when **partial writes** are configured for the cluster_) or all of the data has been rejected. Data that has not been rejected is ingested and queryable.
The response body contains error details about [rejected points](/influxdb/cloud-dedicated/write-data/troubleshoot/#troubleshoot-rejected-points), up to 100 points.
Writes are synchronous--the response status indicates the final status of the write and all ingested data is queryable.
To ensure that InfluxDB handles writes in the order you request them,
wait for the response before you send the next request.
#### Write endpoints
The [`/write`](#operation/PostLegacyWrite) and [`/api/v2/write`](#operation/PostWrite) endpoints are functionally equivalent for writing data to InfluxDB Cloud Dedicated.
- Use the [`/write` endpoint](#operation/PostLegacyWrite) for [InfluxDB v1 parameter compatibility](/influxdb/cloud-dedicated/guides/api-compatibility/v1/).
- Use the [`/api/v2/write` endpoint](#operation/PostWrite) for [InfluxDB v2 parameter compatibility](/influxdb/cloud-dedicated/guides/api-compatibility/v2/).
#### Related guides
- [Get started writing data](/influxdb/cloud-dedicated/get-started/write/)
- [Write data](/influxdb/cloud-dedicated/write-data/)
- [Best practices for writing data](/influxdb/cloud-dedicated/write-data/best-practices/)
- [Troubleshoot issues writing data](/influxdb/cloud-dedicated/write-data/troubleshoot/)
operationId: PostWrite
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: |
The compression applied to the line protocol in the request payload.
To send a gzip payload, pass `Content-Encoding: gzip` header.
in: header
name: Content-Encoding
schema:
default: identity
description: |
Content coding.
Use `gzip` for compressed data or `identity` for unmodified, uncompressed data.
enum:
- gzip
- identity
type: string
- description: |
The format of the data in the request body.
To send a line protocol payload, pass `Content-Type: text/plain; charset=utf-8`.
in: header
name: Content-Type
schema:
default: text/plain; charset=utf-8
description: |
`text/plain` is the content type for line protocol. `UTF-8` is the default character set.
enum:
- text/plain
- text/plain; charset=utf-8
type: string
- description: |
The size of the entity-body, in bytes, sent to InfluxDB.
If the length is greater than the `max body` configuration option,
the server responds with status code `413`.
in: header
name: Content-Length
schema:
description: The length in decimal number of octets.
type: integer
- description: |
The content type that the client can understand.
Writes only return a response body if they fail--for example,
due to a formatting problem or quota limit.
#### InfluxDB Cloud
- Returns only `application/json` for format and limit errors.
- Returns only `text/html` for some quota limit errors.
#### Related guides
- [Troubleshoot issues writing data](/influxdb/cloud-dedicated/write-data/troubleshoot/)
in: header
name: Accept
schema:
default: application/json
description: Error content type.
enum:
- application/json
type: string
- description: |
Ignored. An organization name or ID.
InfluxDB ignores this parameter; authorizes the request using the specified database token
and writes data to the specified cluster database.
in: query
name: org
required: true
schema:
description: The organization name or ID.
type: string
- description: |
Ignored. An organization ID.
InfluxDB ignores this parameter; authorizes the request using the specified database token
and writes data to the specified cluster database.
in: query
name: orgID
schema:
type: string
- description: |
A database name or ID.
InfluxDB writes all points in the batch to the specified database.
in: query
name: bucket
required: true
schema:
description: The database name or ID.
type: string
- description: The precision for unix timestamps in the line protocol batch.
in: query
name: precision
schema:
$ref: '#/components/schemas/WritePrecision'
requestBody:
content:
text/plain:
examples:
plain-utf8:
value: |
airSensors,sensor_id=TLM0201 temperature=73.97038159354763,humidity=35.23103248356096,co=0.48445310567793615 1630424257000000000
airSensors,sensor_id=TLM0202 temperature=75.30007505999716,humidity=35.651929918691714,co=0.5141876544505826 1630424257000000000
schema:
format: byte
type: string
description: |
In the request body, provide data in [line protocol format](/influxdb/cloud-dedicated/reference/syntax/line-protocol/).
To send compressed data, do the following:
1. Use [gzip](https://www.gzip.org/) to compress the line protocol data.
2. In your request, send the compressed data and the
`Content-Encoding: gzip` header.
#### Related guides
- [Best practices for optimizing writes](/influxdb/cloud-dedicated/write-data/best-practices/optimize-writes/)
required: true
responses:
'201':
description: |
Success ("Created"). Some points in the batch are written and queryable, and some points are rejected. The response body contains details about the [rejected points](/influxdb/cloud-dedicated/write-data/troubleshoot/#troubleshoot-rejected-points), up to 100 points.
content:
application/json:
examples:
partialWriteErrorWithRejectedPoints:
summary: Partial write rejects points with syntax errors
value:
code: invalid
line: 2
message: 'failed to parse line protocol: errors encountered on line(s): error message for first rejected point</n> error message for second rejected point</n> error message for Nth rejected point (up to 100 rejected points)'
schema:
$ref: '#/components/schemas/LineProtocolError'
'204':
description: Success ("No Content"). All data in the batch is written and queryable.
'400':
description: All data in body was rejected and not written.
content:
application/json:
examples:
rejectsAllPoints:
summary: Rejected all points
value:
code: invalid
line: 2
message: 'failed to parse line protocol: errors encountered on line(s): error message for first rejected point</n> error message for second rejected point</n> error message for Nth rejected point (up to 100 rejected points)'
schema:
$ref: '#/components/schemas/LineProtocolError'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/ResourceNotFoundError'
'500':
$ref: '#/components/responses/InternalServerError'
'503':
description: |
Service unavailable.
- Returns this error if
the server is temporarily unavailable to accept writes.
- Returns a `Retry-After` header that describes when to try the write again.
headers:
Retry-After:
description: Non-negative decimal integer indicating seconds to wait before retrying the request.
schema:
format: int32
type: integer
default:
$ref: '#/components/responses/GeneralServerError'
summary: Write data
tags:
- Data I/O endpoints
- Write
/query:
get:
description: Queries InfluxDB using InfluxQL with InfluxDB v1 request and response formats.
operationId: GetLegacyQuery
parameters:
- $ref: '#/components/parameters/TraceSpan'
- in: header
name: Accept
schema:
default: application/json
description: |
Media type that the client can understand.
**Note**: With `application/csv`, query results include [**unix timestamps**](/influxdb/cloud-dedicated/reference/glossary/#unix-timestamp) instead of [RFC3339 timestamps](/influxdb/cloud-dedicated/reference/glossary/#rfc3339-timestamp).
enum:
- application/json
- application/csv
- text/csv
- application/x-msgpack
type: string
- description: The content encoding (usually a compression algorithm) that the client can understand.
in: header
name: Accept-Encoding
schema:
default: identity
description: The content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data.
enum:
- gzip
- identity
type: string
- in: header
name: Content-Type
schema:
enum:
- application/json
type: string
- description: The InfluxDB 1.x username to authenticate the request.
in: query
name: u
schema:
type: string
- description: The InfluxDB 1.x password to authenticate the request.
in: query
name: p
schema:
type: string
- description: |
The [database](/influxdb/cloud-dedicated/admin/databases/) to query data from.
in: query
name: db
required: true
schema:
type: string
- description: |
The retention policy to query data from.
For more information, see [InfluxQL DBRP naming convention](/influxdb/cloud-dedicated/admin/databases/create/#influxql-dbrp-naming-convention).
in: query
name: rp
schema:
type: string
- description: The InfluxQL query to execute. To execute multiple queries, delimit queries with a semicolon (`;`).
in: query
name: q
required: true
schema:
type: string
- description: |
A unix timestamp precision.
Formats timestamps as [unix (epoch) timestamps](/influxdb/cloud-dedicated/reference/glossary/#unix-timestamp) the specified precision
instead of [RFC3339 timestamps](/influxdb/cloud-dedicated/reference/glossary/#rfc3339-timestamp) with nanosecond precision.
in: query
name: epoch
schema:
enum:
- ns
- u
- µ
- ms
- s
- m
- h
type: string
responses:
'200':
content:
application/csv:
schema:
$ref: '#/components/schemas/InfluxqlCsvResponse'
application/json:
schema:
$ref: '#/components/schemas/InfluxqlJsonResponse'
examples:
influxql-chunk_size_2:
value: |
{"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}]}
{"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"]]}]}]}
application/x-msgpack:
schema:
format: binary
type: string
text/csv:
schema:
$ref: '#/components/schemas/InfluxqlCsvResponse'
description: Query results
headers:
Content-Encoding:
description: Lists encodings (usually compression algorithms) that have been applied to the response payload.
schema:
default: identity
description: |
The content coding:
- `gzip`: compressed data
- `identity`: unmodified, uncompressed data.
enum:
- gzip
- identity
type: string
Trace-Id:
description: The trace ID, if generated, of the request.
schema:
description: Trace ID of a request.
type: string
'429':
description: |
#### InfluxDB Cloud:
- returns this error if a **read** or **write** request exceeds your
plan's [adjustable service quotas](/influxdb/cloud-dedicated/account-management/limits/#adjustable-service-quotas)
or if a **delete** request exceeds the maximum
[global limit](/influxdb/cloud-dedicated/account-management/limits/#global-limits)
- returns `Retry-After` header that describes when to try the write again.
headers:
Retry-After:
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
schema:
format: int32
type: integer
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Error processing query
summary: Query using the InfluxDB v1 HTTP API
tags:
- Query
- Data I/O endpoints
/write:
post:
operationId: PostLegacyWrite
description: |
Writes data to a database.
Use this endpoint for [InfluxDB v1 parameter compatibility](/influxdb/cloud-dedicated/guides/api-compatibility/v1/) when sending data in [line protocol](/influxdb/cloud-dedicated/reference/syntax/line-protocol/) format to InfluxDB.
InfluxDB Cloud Dedicated does the following when you send a write request:
1. Validates the request.
2. If successful, attempts to [ingest data](/influxdb/cloud-dedicated/reference/internals/durability/#data-ingest) from the request body; otherwise, responds with an [error status](/influxdb/cloud-dedicated/write-data/troubleshoot/#review-http-status-codes).
3. Ingests or rejects data in the batch and returns one of the following HTTP status codes:
- `204 No Content`: all data in the batch is ingested
- `201 Created` (_If the cluster is configured to allow **partial writes**_): some points in the batch are ingested and queryable, and some points are rejected
- `400 Bad Request`: all data is rejected
The response body contains error details about [rejected points](/influxdb/cloud-dedicated/write-data/troubleshoot/#troubleshoot-rejected-points), up to 100 points.
Writes are synchronous--the response status indicates the final status of the write and all ingested data is queryable.
To ensure that InfluxDB handles writes in the order you request them,
wait for the response before you send the next request.
#### Write endpoints
The [`/write`](#operation/PostLegacyWrite) and [`/api/v2/write`](#operation/PostWrite) endpoints are functionally equivalent for writing data to InfluxDB Cloud Dedicated.
- Use the [`/write` endpoint](#operation/PostLegacyWrite) for [InfluxDB v1 parameter compatibility](/influxdb/cloud-dedicated/guides/api-compatibility/v1/).
- Use the [`/api/v2/write` endpoint](#operation/PostWrite) for [InfluxDB v2 parameter compatibility](/influxdb/cloud-dedicated/guides/api-compatibility/v2/).
#### Related guides
- [Get started writing data](/influxdb/cloud-dedicated/get-started/write/)
- [Write data](/influxdb/cloud-dedicated/write-data/)
- [Best practices for writing data](/influxdb/cloud-dedicated/write-data/best-practices/)
- [Troubleshoot issues writing data](/influxdb/cloud-dedicated/write-data/troubleshoot/)
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The InfluxDB 1.x username to authenticate the request.
in: query
name: u
schema:
type: string
- description: The InfluxDB 1.x password to authenticate the request.
in: query
name: p
schema:
type: string
- description: database to write to. If none exists, InfluxDB creates a database with a default 3-day retention policy.
in: query
name: db
required: true
schema:
type: string
- description: Retention policy name.
in: query
name: rp
schema:
type: string
- description: Write precision.
in: query
name: precision
schema:
type: string
- description: When present, its value indicates to the database that compression is applied to the line protocol body.
in: header
name: Content-Encoding
schema:
default: identity
description: Specifies that the line protocol in the body is encoded with gzip or not encoded with identity.
enum:
- gzip
- identity
type: string
requestBody:
content:
text/plain:
schema:
type: string
description: Line protocol body
required: true
responses:
'204':
description: Success ("No Content"). All data in the batch is written and queryable.
'400':
description: |
Data from the batch was rejected and not written. The response body indicates if a partial write occurred or all data was rejected.
If a partial write occurred, then some points from the batch are written and queryable.
The response body contains details about the [rejected points](/influxdb/cloud-dedicated/write-data/troubleshoot/#troubleshoot-rejected-points), up to 100 points.
content:
application/json:
examples:
rejectedAllPoints:
summary: Rejected all points
value:
code: invalid
line: 2
message: 'no data written, errors encountered on line(s): error message for first rejected point</n> error message for second rejected point</n> error message for Nth rejected point (up to 100 rejected points)'
partialWriteErrorWithRejectedPoints:
summary: Partial write rejects some points
value:
code: invalid
line: 2
message: 'partial write has occurred, errors encountered on line(s): error message for first rejected point</n> error message for second rejected point</n> error message for Nth rejected point (up to 100 rejected points)'
schema:
$ref: '#/components/schemas/LineProtocolError'
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Token doesn't have sufficient permissions to write to this database or the database doesn't exist.
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: No token was sent and they are required.
'413':
content:
application/json:
schema:
$ref: '#/components/schemas/LineProtocolLengthError'
description: Write has been rejected because the payload is too large. Error message returns max size supported. All data in body was rejected and not written.
'422':
description: |
Unprocessable Entity.
The request contained data outside the database’s retention period. InfluxDB rejected the batch and wrote no data.
The response body contains details about the [rejected points](/influxdb/cloud-dedicated/write-data/troubleshoot/#troubleshoot-rejected-points).
'429':
description: Token is temporarily over quota. The Retry-After header describes when to try the write again.
headers:
Retry-After:
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
schema:
format: int32
type: integer
'503':
description: Server is temporarily unavailable to accept writes. The Retry-After header describes when to try the write again.
headers:
Retry-After:
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
schema:
format: int32
type: integer
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Internal server error
summary: Write data using the InfluxDB v1 HTTP API
tags:
- Data I/O endpoints
- Write
components:
parameters:
TraceSpan:
description: OpenTracing span context
example:
baggage:
key: value
span_id: '1'
trace_id: '1'
in: header
name: Zap-Trace-Span
required: false
schema:
type: string
responses:
AuthorizationError:
content:
application/json:
examples:
tokenNotAuthorized:
summary: Token is not authorized to access a resource
value:
code: unauthorized
message: unauthorized access
schema:
properties:
code:
description: |
The HTTP status code description. Default is `unauthorized`.
enum:
- unauthorized
readOnly: true
type: string
message:
description: A human-readable message that may contain detail about the error.
readOnly: true
type: string
description: |
Unauthorized. The error may indicate one of the following:
* The `Authorization: Token` header is missing or malformed.
* The API token value is missing from the header.
* The token doesn't have sufficient permissions to write to or query the database.
BadRequestError:
content:
application/json:
examples:
orgProvidedNotFound:
summary: The org or orgID passed doesn't own the token passed in the header
value:
code: invalid
message: 'failed to decode request body: organization not found'
schema:
$ref: '#/components/schemas/Error'
description: |
Bad request.
The response body contains details about the error.
GeneralServerError:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Non 2XX error response from server.
InternalServerError:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: |
Internal server error.
The server encountered an unexpected situation.
ResourceNotFoundError:
content:
application/json:
examples:
bucket-not-found:
summary: database name not found
value:
code: not found
message: database "air_sensor" not found
org-not-found:
summary: Organization name not found
value:
code: not found
message: organization name "my-org" not found
orgID-not-found:
summary: Organization ID not found
value:
code: not found
message: organization not found
schema:
$ref: '#/components/schemas/Error'
description: |
Not found.
A requested resource was not found.
The response body contains the requested resource type and the name value
(if you passed it)--for example:
- `"organization name \"my-org\" not found"`
- `"organization not found"`: indicates you passed an ID that did not match
an organization.
ServerError:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Non 2XX error response from server.
schemas:
AddResourceMemberRequestBody:
properties:
id:
description: |
The ID of the user to add to the resource.
type: string
name:
description: |
The name of the user to add to the resource.
type: string
required:
- id
type: object
AnalyzeQueryResponse:
properties:
errors:
items:
properties:
character:
type: integer
column:
type: integer
line:
type: integer
message:
type: string
type: object
type: array
type: object
BadStatement:
description: A placeholder for statements for which no correct statement nodes can be created
properties:
text:
description: Raw source text
type: string
type:
$ref: '#/components/schemas/NodeType'
type: object
BooleanLiteral:
description: Represents boolean values
properties:
type:
$ref: '#/components/schemas/NodeType'
value:
type: boolean
type: object
ConstantVariableProperties:
properties:
type:
enum:
- constant
type: string
values:
items:
type: string
type: array
DBRP:
properties:
bucketID:
description: |
A database ID.
Identifies the database used as the target for the translation.
type: string
database:
description: |
A database name.
Identifies the InfluxDB v1 database.
type: string
default:
description: |
If set to `true`, this DBRP mapping is the default retention policy
for the database (specified by the `database` property's value).
type: boolean
id:
description: |
The resource ID that InfluxDB uses to uniquely identify the database retention policy (DBRP) mapping.
readOnly: true
type: string
links:
$ref: '#/components/schemas/Links'
orgID:
description: |
An organization ID.
Identifies the [organization](/influxdb/cloud-dedicated/reference/glossary/#organization) that owns the mapping.
type: string
retention_policy:
description: |
A [retention policy](/influxdb/v1.8/concepts/glossary/#retention-policy-rp) name.
Identifies the InfluxDB v1 retention policy mapping.
type: string
virtual:
description: Indicates an autogenerated, virtual mapping based on the database name. Currently only available in OSS.
type: boolean
required:
- id
- orgID
- bucketID
- database
- retention_policy
- default
type: object
DBRPCreate:
properties:
bucketID:
description: |
A database ID.
Identifies the database used as the target for the translation.
type: string
database:
description: |
A database name.
Identifies the InfluxDB v1 database.
type: string
default:
description: |
Set to `true` to use this DBRP mapping as the default retention policy
for the database (specified by the `database` property's value).
type: boolean
org:
description: |
An organization name.
Identifies the [organization](/influxdb/cloud-dedicated/reference/glossary/#organization) that owns the mapping.
type: string
orgID:
description: |
An organization ID.
Identifies the [organization](/influxdb/cloud-dedicated/reference/glossary/#organization) that owns the mapping.
type: string
retention_policy:
description: |
A [retention policy](/influxdb/v1.8/concepts/glossary/#retention-policy-rp) name.
Identifies the InfluxDB v1 retention policy mapping.
type: string
required:
- bucketID
- database
- retention_policy
type: object
DBRPGet:
properties:
content:
$ref: '#/components/schemas/DBRP'
required: true
type: object
DBRPUpdate:
properties:
default:
description: |
Set to `true` to use this DBRP mapping as the default retention policy
for the database (specified by the `database` property's value).
To remove the default mapping, set to `false`.
type: boolean
retention_policy:
description: |
A [retention policy](/influxdb/v1.8/concepts/glossary/#retention-policy-rp) name.
Identifies the InfluxDB v1 retention policy mapping.
type: string
DBRPs:
properties:
content: