-
Notifications
You must be signed in to change notification settings - Fork 10
/
oss.yml
19353 lines (18575 loc) · 636 KB
/
oss.yml
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 OSS API Service
version: 2.0.0
description: |
The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint.
license:
name: MIT
url: 'https://opensource.org/licenses/MIT'
servers:
- url: /api/v2
tags:
- name: Authorizations (API tokens)
description: |
Create and manage authorizations (API tokens).
An _authorization_ contains a list of `read` and `write`
permissions for organization resources and provides an API token for authentication.
An authorization belongs to an organization and only contains permissions for that organization.
We recommend creating a generic user to create and manage tokens for writing data.
### User sessions with authorizations
Optionally, when creating an authorization, you can scope it to a specific user.
If a user signs in with username and password, creating a _user session_,
the session carries the permissions granted by all the user's authorizations.
For more information, see [how to assign a token to a specific user](https://docs.influxdata.com/influxdb/latest/security/tokens/create-token/).
To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).
### Related endpoints
- [Signin](#tag/Signin)
- [Signout](#tag/Signout)
### Related guides
- [Authorize API requests](https://docs.influxdata.com/influxdb/latest/api-guide/api_intro/#authentication)
- [Manage API tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/)
- [Assign a token to a specific user](https://docs.influxdata.com/influxdb/latest/security/tokens/create-token/)
- name: Buckets
description: |
Store your data in InfluxDB [buckets](https://docs.influxdata.com/influxdb/latest/reference/glossary/#bucket).
A bucket is a named location where time series data is stored. All buckets
have a [retention period](https://docs.influxdata.com/influxdb/latest/reference/glossary/#retention-period),
a duration of time that each data point persists. InfluxDB drops all
points with timestamps older than the bucket’s retention period.
A bucket belongs to an organization.
### Related guides
- [Manage buckets](https://docs.influxdata.com/influxdb/latest/organizations/buckets/)
- name: DBRPs
description: |
The InfluxDB 1.x data model includes [databases](https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#database)
and [retention policies](https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#retention-policy-rp).
InfluxDB 2.x replaces databases and retention policies with buckets.
To support InfluxDB 1.x query and write patterns in InfluxDB 2.x,
databases and retention policies are mapped to buckets using the
database and retention policy (DBRP) mapping service.
The DBRP mapping service uses the database and retention policy
specified in 1.x compatibility API requests to route operations to a bucket.
### Related guides
- [Database and retention policy mapping](https://docs.influxdata.com/influxdb/latest/reference/api/influxdb-1x/dbrp/)
- name: Debug
description: |
Generate profiling and trace reports.
Use routes under `/debug/pprof` to analyze the Go runtime of InfluxDB.
These endpoints generate [Go runtime profiles](https://pkg.go.dev/runtime/pprof)
and **trace** reports.
**Profiles** are collections of stack traces that show call sequences
leading to instances of a particular event, such as allocation.
For more information about **pprof profile** and **trace** reports,
see the following resources:
- [Google pprof tool](https://github.com/google/pprof)
- [Golang diagnostics](https://go.dev/doc/diagnostics)
- name: Delete
description: |
Delete data from an InfluxDB bucket.
- name: Organizations
description: |
Create and manage your [organizations](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization).
An organization is a workspace for a group of users. Organizations can be
used to separate different environments, projects, teams or users within
InfluxDB.
Use the `/api/v2/orgs` endpoints to create, view, and manage organizations.
- name: Query
description: |
Retrieve data, analyze queries, and get query suggestions.
- name: Tasks
description: |
Process and analyze your data with [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task)
in the InfluxDB task engine.
Use the `/api/v2/tasks` endpoints to schedule and manage tasks, retry task runs, and retrieve run logs.
To configure a task, provide the script and the schedule to run the task.
For examples, see how to create a task with the [`POST /api/v2/tasks` endpoint](#operation/PostTasks).
<span id="tasks-schemaref-task" />
### Properties
A `task` object contains information about an InfluxDB task resource.
The following table defines the properties that appear in a `task` object:
<SchemaDefinition schemaRef="#/components/schemas/Task" />
### Related guides
- [Get started with tasks](https://docs.influxdata.com/influxdb/latest/process-data/get-started/)
- [Common data processing tasks](https://docs.influxdata.com/influxdb/latest/process-data/common-tasks/)
- name: Templates
description: |
Export and apply InfluxDB **templates**.
Manage **stacks** of templated InfluxDB resources.
InfluxDB templates are prepackaged configurations for
everything from dashboards and Telegraf to notifications and alerts.
Use InfluxDB templates to quickly configure a fresh instance of InfluxDB,
back up your dashboard configuration, or share your configuration with the
InfluxData community.
Use the `/api/v2/templates` endpoints to export templates and apply templates.
**InfluxDB stacks** are stateful InfluxDB templates that let you
add, update, and remove installed template resources over time, avoid duplicating
resources when applying the same or similar templates more than once, and
apply changes to distributed instances of InfluxDB OSS or InfluxDB Cloud.
Use the `/api/v2/stacks` endpoints to manage installed template resources.
### Related guides
- [InfluxDB stacks](https://docs.influxdata.com/influxdb/latest/influxdb-templates/stacks/)
- [InfluxDB templates](https://docs.influxdata.com/influxdb/latest/influxdb-templates/)
- name: Users
description: |
Manage users for your organization.
Users are those with access to InfluxDB.
To grant a user permission to access data, add them as a member of an
organization and provide them with an API token.
### User sessions with authorizations
Optionally, you can scope an authorization (and its API token) to a user.
If a user signs in with username and password, creating a _user session_,
the session carries the permissions granted by all the user's authorizations.
To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).
### Related guides
- [Manage users](https://docs.influxdata.com/influxdb/latest/influxdb/latest/users/)
- [Create a token scoped to a user](https://docs.influxdata.com/influxdb/latest/latest/security/tokens/create-token/#create-a-token-scoped-to-a-user)
- name: Write
description: |
Write time series data to [buckets](https://docs.influxdata.com/influxdb/latest/reference/glossary/#bucket).
- name: Authentication
description: |
Use one of the following schemes to authenticate to the InfluxDB API:
- [Token authentication](#section/Authentication/TokenAuthentication)
- [Basic authentication](#section/Authentication/BasicAuthentication)
- [Querystring authentication](#section/Authentication/QuerystringAuthentication)
<!-- ReDoc-Inject: <security-definitions> -->
x-traitTag: true
- name: Quick start
x-traitTag: true
description: |
See the [**API Quick Start**](https://docs.influxdata.com/influxdb/latest/api-guide/api_intro/)
to get up and running authenticating with tokens, writing to buckets, and querying data.
[**InfluxDB API client libraries**](https://docs.influxdata.com/influxdb/latest/api-guide/client-libraries/)
are available for popular languages and ready to import into your application.
- name: Supported operations
x-traitTag: true
description: "The following table shows the most common operations that the InfluxDB `/api/v2` API supports.\nSome resources may support other operations that perform functions more specific to those resources.\nFor example, you can use the `PATCH /api/v2/scripts` endpoint to update properties of a script\nresource.\n\n| Operation | |\n|:----------|:-----------------------------------------------------------------------|\n| Write | Writes (`POST`) data to a bucket. |\n| Run | Executes (`POST`) a query or script and returns the result. |\n| List |\tRetrieves (`GET`) a list of zero or more resources. |\n| Create |\tCreates (`POST`) a new resource and returns the resource. |\n| Update |\tModifies (`PUT`) an existing resource to reflect data in your request. |\n| Delete |\tRemoves (`DELETE`) a specific resource. |\n"
- name: Headers
x-traitTag: true
description: |
InfluxDB `/api/v2` 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: Common parameters
x-traitTag: true
description: |
To specify resources, some InfluxDB API endpoints require parameters or
properties in the request--for example,
writing to a `bucket` resource in an `org` (_organization_ resource).
### Common parameters
| Query parameter | Value type | Description |
|:------------------------ |:--------------------- |:-------------------------------------------|
| `bucket` | string | The bucket name or ID ([find your bucket](https://docs.influxdata.com/influxdb/latest/organizations/buckets/view-buckets/). |
| `bucketID` | string | The bucket ID ([find your bucket](https://docs.influxdata.com/influxdb/latest/organizations/buckets/view-buckets/). |
| `org` | string | The organization name or ID ([find your organization](https://docs.influxdata.com/influxdb/latest/organizations/view-orgs/). |
| `orgID` | 16-byte string | The organization ID ([find your organization](https://docs.influxdata.com/influxdb/latest/organizations/view-orgs/). |
- name: Pagination
x-traitTag: true
description: |
Some InfluxDB API [list operations](#tag/SupportedOperations) may support the following query parameters for paginating results:
| Query parameter | Value type | Description |
|:------------------------ |:--------------------- |:-------------------------------------------|
| `limit` | integer | The maximum number of records to return (after other parameters are applied). |
| `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). |
| `after` | string (resource ID) | Only returns resources created after the specified resource. |
### Limitations
- For specific endpoint parameters and examples, see the endpoint definition.
- If you specify an `offset` parameter value greater than the total number of records,
then InfluxDB returns an empty list in the response
(given `offset` skips the specified number of records).
The following example passes `offset=50` to skip the first 50 results,
but the user only has 10 buckets:
```sh
curl --request GET "INFLUX_URL/api/v2/buckets?limit=1&offset=50" \
--header "Authorization: Token INFLUX_API_TOKEN"
```
The response contains the following:
```json
{
"links": {
"prev": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=49\u0026orgID=ORG_ID",
"self": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=50\u0026orgID=ORG_ID"
},
"buckets": []
}
```
- name: Response codes
x-traitTag: true
description: |
InfluxDB `/api/v2` 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 | |
| `204` | No content | For a `POST` request, `204` indicates that InfluxDB accepted the request and request data is valid. Asynchronous operations, such as `write`, might not have completed yet. |
| `400` | Bad request | May indicate one of the following: <ul><li>Line protocol is malformed. The response body contains the first malformed line in the data and indicates what was expected. For partial writes, the number of points written and the number of points rejected are also included. For more information, check the `rejected_points` measurement in your `_monitoring` bucket.</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 API tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/)</li></ul> |
| `404` | Not found | Requested resource was not found. `message` in the response body provides details about the requested resource. |
| `413` | Request entity too large | Request payload exceeds the size limit. |
| `422` | Unprocessable entity | Request data is invalid. `code` and `message` in the response body provide details about the problem. |
| `429` | Too many requests | API token is temporarily over the request quota. The `Retry-After` header describes when to try the request again. |
| `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. |
x-tagGroups:
- name: Overview
tags:
- Quick start
- Authentication
- Supported operations
- Headers
- Common parameters
- Pagination
- Response codes
- name: Popular endpoints
tags:
- Data I/O endpoints
- Security and access endpoints
- System information endpoints
- name: All endpoints
tags: []
paths:
/signin:
post:
operationId: PostSignin
summary: Create a user session.
description: |
Authenticates [Basic authentication credentials](#section/Authentication/BasicAuthentication)
for a [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user),
and then, if successful, generates a user session.
To authenticate a user, pass the HTTP `Authorization` header with the
`Basic` scheme and the base64-encoded username and password.
For syntax and more information, see [Basic Authentication](#section/Authentication/BasicAuthentication) for
syntax and more information.
If authentication is successful, InfluxDB creates a new session for the user
and then returns the session cookie in the `Set-Cookie` response header.
InfluxDB stores user sessions in memory only.
They expire within ten minutes and during restarts of the InfluxDB instance.
#### User sessions with authorizations
- In InfluxDB Cloud, a user session inherits all the user's permissions for
the organization.
- In InfluxDB OSS, a user session inherits all the user's permissions for all
the organizations that the user belongs to.
#### Related endpoints
- [Signout](#tag/Signout)
tags:
- Security and access endpoints
- Signin
security:
- BasicAuthentication: []
parameters:
- $ref: '#/components/parameters/TraceSpan'
responses:
'204':
description: |
Success.
The user is authenticated.
The `Set-Cookie` response header contains the session cookie.
'401':
description: |
Unauthorized.
This error may be caused by one of the following problems:
- The user doesn't have access.
- The user passed incorrect credentials in the request.
- The credentials are formatted incorrectly in the request.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden. The user account is disabled.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
default:
description: Unsuccessful authentication.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-codeSamples:
- lang: Shell
label: 'cURL: signin with --user option encoding'
source: |
curl --request POST http://localhost:8086/api/v2/signin \
--user "USERNAME:PASSWORD"
/signout:
post:
operationId: PostSignout
summary: Expire a user session
tags:
- Security and access endpoints
- Signout
description: |
Expires a user session specified by a session cookie.
Use this endpoint to expire a user session that was generated when the user
authenticated with the InfluxDB Developer Console (UI) or the `POST /api/v2/signin` endpoint.
For example, the `POST /api/v2/signout` endpoint represents the third step
in the following three-step process
to authenticate a user, retrieve the `user` resource, and then expire the session:
1. Send a request with the user's [Basic authentication credentials](#section/Authentication/BasicAuthentication)
to the `POST /api/v2/signin` endpoint to create a user session and
generate a session cookie.
2. Send a request to the `GET /api/v2/me` endpoint, passing the stored session cookie
from step 1 to retrieve user information.
3. Send a request to the `POST /api/v2/signout` endpoint, passing the stored session
cookie to expire the session.
_See the complete example in request samples._
InfluxDB stores user sessions in memory only.
If a user doesn't sign out, then the user session automatically expires within ten minutes or
during a restart of the InfluxDB instance.
To learn more about cookies in HTTP requests, see
[Mozilla Developer Network (MDN) Web Docs, HTTP cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies).
#### Related endpoints
- [Signin](#tag/Signin)
parameters:
- $ref: '#/components/parameters/TraceSpan'
responses:
'204':
description: Success. The session is expired.
'401':
description: Unauthorized.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
default:
description: The session expiry is unsuccessful.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-codeSamples:
- lang: Shell
label: 'cURL: sign in a user, verify the user session, and then end the session'
source: |
# The following example shows how to use cURL and the InfluxDB API
# to do the following:
# 1. Sign in a user with a username and password.
# 2. Check that the user session exists for the user.
# 3. Sign out the user to expire the session.
# 4. Check that the session is no longer active.
# 1. Send a request to `POST /api/v2/signin` to sign in the user.
# In your request, pass the following:
#
# - `--user` option with basic authentication credentials.
# - `-c` option with a file path where cURL will write cookies.
curl --request POST \
-c ./cookie-file.tmp \
"$INFLUX_URL/api/v2/signin" \
--user "${INFLUX_USER_NAME}:${INFLUX_USER_PASSWORD}"
# 2. To check that a user session exists for the user in step 1,
# send a request to `GET /api/v2/me`.
# In your request, pass the `-b` option with the session cookie file path from step 1.
curl --request GET \
-b ./cookie-file.tmp \
"$INFLUX_URL/api/v2/me"
# InfluxDB responds with the `user` resource.
# 3. Send a request to `POST /api/v2/signout` to expire the user session.
# In your request, pass the `-b` option with the session cookie file path from step 1.
curl --request POST \
-b ./cookie-file.tmp \
"$INFLUX_URL/api/v2/signout"
# If the user session is successfully expired, InfluxDB responds with
an HTTP `204` status code.
# 4. To check that the user session is expired, call `GET /api/v2/me` again,
# passing the `-b` option with the cookie file path.
curl --request GET \
-b ./cookie-file.tmp \
"$INFLUX_URL/api/v2/me"
# If the user session is expired, InfluxDB responds with an HTTP `401` status code.
/ping:
get:
operationId: GetPing
summary: Get the status of the instance
description: |
Retrieves the status and InfluxDB version of the instance.
Use this endpoint to monitor uptime for the InfluxDB instance. The response
returns a HTTP `204` status code to inform you the instance is available.
#### InfluxDB Cloud
- Isn't versioned and doesn't return `X-Influxdb-Version` in the headers.
#### Related guides
- [Influx ping](https://docs.influxdata.com/influxdb/latest/reference/cli/influx/ping/)
servers:
- url: ''
tags:
- Ping
- System information endpoints
responses:
'204':
description: |
Success.
Headers contain InfluxDB version information.
headers:
X-Influxdb-Build:
schema:
type: string
description: |
The type of InfluxDB build.
X-Influxdb-Version:
schema:
type: integer
description: |
The version of InfluxDB.
#### InfluxDB Cloud
- Doesn't return version.
x-codeSamples:
- lang: Shell
label: cURL
source: |
curl --request GET "http://localhost:8086/ping"
head:
operationId: HeadPing
summary: Get the status of the instance
description: |
Returns the status and InfluxDB version of the instance.
Use this endpoint to monitor uptime for the InfluxDB instance. The response
returns a HTTP `204` status code to inform you the instance is available.
#### InfluxDB Cloud
- Isn't versioned and doesn't return `X-Influxdb-Version` in the headers.
#### Related guides
- [Influx ping](https://docs.influxdata.com/influxdb/latest/reference/cli/influx/ping/)
servers:
- url: ''
tags:
- Ping
responses:
'204':
description: |
Success.
Headers contain InfluxDB version information.
headers:
X-Influxdb-Build:
schema:
type: string
description: The type of InfluxDB build.
X-Influxdb-Version:
schema:
type: integer
description: |
The version of InfluxDB.
#### InfluxDB Cloud
- Doesn't return version.
x-codeSamples:
- lang: Shell
label: cURL
source: |
curl --request HEAD "http://localhost:8086/ping"
/:
get:
operationId: GetRoutes
summary: List all top level routes
description: |
Retrieves all the top level routes for the InfluxDB API.
#### Limitations
- Only returns top level routes--for example, the response contains
`"tasks":"/api/v2/tasks"`, and doesn't contain resource-specific routes
for tasks (`/api/v2/tasks/TASK_ID/...`).
tags:
- Routes
- System information endpoints
parameters:
- $ref: '#/components/parameters/TraceSpan'
responses:
'200':
description: |
Success.
The response body contains key-value pairs with the resource name and
top-level route.
content:
application/json:
schema:
$ref: '#/components/schemas/Routes'
/dbrps:
get:
operationId: GetDBRPs
tags:
- DBRPs
summary: List database retention policy mappings
description: |
Lists database retention policy (DBRP) mappings.
#### Related guide
- [Database and retention policy mapping](https://docs.influxdata.com/influxdb/latest/reference/api/influxdb-1x/dbrp/)
parameters:
- $ref: '#/components/parameters/TraceSpan'
- in: query
name: orgID
description: |
An organization ID.
Only returns DBRP mappings for the specified organization.
schema:
type: string
- in: query
name: org
description: |
An organization name.
Only returns DBRP mappings for the specified organization.
schema:
type: string
- in: query
name: id
description: |
A DBPR mapping ID.
Only returns the specified DBRP mapping.
schema:
type: string
- in: query
name: bucketID
description: |
A bucket ID.
Only returns DBRP mappings that belong to the specified bucket.
schema:
type: string
- in: query
name: default
description: Specifies filtering on default
schema:
type: boolean
- in: query
name: db
description: |
A database.
Only returns DBRP mappings that belong to the 1.x database.
schema:
type: string
- in: query
name: rp
description: |
A [retention policy](https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#retention-policy-rp).
Specifies the 1.x retention policy to filter on.
schema:
type: string
responses:
'200':
description: Success. The response body contains a list of database retention policy mappings.
content:
application/json:
schema:
$ref: '#/components/schemas/DBRPs'
examples:
successResponse:
value:
content:
- id: 0a3cbb5dd526a000
database: example_database_1
retention_policy: autogen
default: true
orgID: bea7ea952287f70d
bucketID: 4d4d9d5b61dee751
- id: 0a3cbcde20e38000
database: example_database_2
retention_policy: example_retention_policy
default: false
orgID: bea7ea952287f70d
bucketID: 4d4d9d5b61dee751
'400':
description: Bad request. The request has one or more invalid parameters.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalidRequest:
description: |
The query parameters contain invalid values.
value:
code: invalid
message: invalid ID
'401':
$ref: '#/components/responses/AuthorizationError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
operationId: PostDBRP
tags:
- DBRPs
summary: Add a database retention policy mapping
description: |
Creates a database retention policy (DBRP) mapping and returns the mapping.
Use this endpoint to add InfluxDB 1.x API compatibility to your
InfluxDB Cloud or InfluxDB OSS 2.x buckets. Your buckets must contain a
DBRP mapping in order to query and write using the InfluxDB 1.x API.
object.
#### Related guide
- [Database and retention policy mapping](https://docs.influxdata.com/influxdb/latest/reference/api/influxdb-1x/dbrp/)
parameters:
- $ref: '#/components/parameters/TraceSpan'
requestBody:
description: |
The database retention policy mapping to add.
Note that _`retention_policy`_ is a required parameter in the request body.
The value of _`retention_policy`_ can be any arbitrary `string` name or
value, with the default value commonly set as `autogen`.
The value of _`retention_policy`_ isn't a [retention_policy](https://docs.influxdata.com/influxdb/latest/reference/glossary/#retention-policy-rp)
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DBRPCreate'
responses:
'201':
description: Created. The response body contains the database retention policy mapping.
content:
application/json:
schema:
$ref: '#/components/schemas/DBRP'
examples:
successResponse:
value:
id: 0a3cbb5dd526a000
database: example_database
retention_policy: autogen
default: true
orgID: bea7ea952287f70d
bucketID: 4d4d9d5b61dee751
'400':
description: Bad request. The mapping in the request has one or more invalid IDs.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalidRequest:
description: |
The query parameters contain invalid values.
value:
code: invalid
message: invalid ID
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/ResourceNotFoundError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-codeSamples:
- lang: Shell
label: 'cURL: create a database retention policy mapping'
source: |
curl --request POST \
"http://localhost:8086/api/v2/dbrp/" \
--header 'Content-type: application/json' \
--header "Authorization: Token INFLUXDB_TOKEN" \
--data-binary @- << EOF
{ \
"bucketID": "INFLUXDB_BUCKET_ID", \
"orgID": "INFLUXDB_ORG_ID", \
"database": "database_name", \
"default": true, \
"retention_policy": "example_retention_policy_name" \
}
EOF
'/dbrps/{dbrpID}':
get:
operationId: GetDBRPsID
tags:
- DBRPs
summary: Retrieve a database retention policy mapping
description: |
Retrieves the specified retention policy (DBRP) mapping.
#### Related guide
- [Database and retention policy mapping](https://docs.influxdata.com/influxdb/latest/reference/api/influxdb-1x/dbrp/)
parameters:
- $ref: '#/components/parameters/TraceSpan'
- in: query
name: orgID
description: |
An organization ID.
Specifies the organization that owns the DBRP mapping.
schema:
type: string
- in: query
name: org
description: |
An organization name.
Specifies the organization that owns the DBRP mapping.
schema:
type: string
- in: path
name: dbrpID
schema:
type: string
required: true
description: |
A DBRP mapping ID.
Specifies the DBRP mapping.
responses:
'200':
description: Success. The response body contains the DBRP mapping.
content:
application/json:
schema:
$ref: '#/components/schemas/DBRPGet'
examples:
successResponse:
value:
content:
id: 0a3cbb5dd526a000
database: example_database_1
retention_policy: autogen
default: true
orgID: bea7ea952287f70d
bucketID: 4d4d9d5b61dee751
'400':
description: Bad Request. Query parameters contain invalid values.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalidRequest:
description: |
The query parameters contain invalid values.
value:
code: invalid
message: invalid ID
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/ResourceNotFoundError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
patch:
operationId: PatchDBRPID
tags:
- DBRPs
summary: Update a database retention policy mapping
requestBody:
description: |
Updates the database retention policy (DBRP) mapping and returns the mapping.
Use this endpoint to modify the _retention policy_ (`retention_policy` property) of a DBRP mapping.
#### Related guide
- [Database and retention policy mapping](https://docs.influxdata.com/influxdb/latest/reference/api/influxdb-1x/dbrp/)
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DBRPUpdate'
parameters:
- $ref: '#/components/parameters/TraceSpan'
- in: query
name: orgID
description: |
An organization ID.
Specifies the organization that owns the DBRP mapping.
schema:
type: string
- in: query
name: org
description: |
An organization name.
Specifies the organization that owns the DBRP mapping.
schema:
type: string
- in: path
name: dbrpID
schema:
type: string
required: true
description: |
A DBRP mapping ID.
Specifies the DBRP mapping.
responses:
'200':
description: An updated mapping
content:
application/json:
schema:
$ref: '#/components/schemas/DBRPGet'
examples:
successResponse:
value:
content:
id: 0a3cbb5dd526a000
database: example_database
retention_policy: example_retention_policy
default: false
orgID: bea7ea952287f70d
bucketID: 4d4d9d5b61dee751
'400':
description: Bad Request. Query parameters contain invalid values.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalidRequest:
description: |
The query parameters contain invalid values.
value:
code: invalid
message: invalid ID
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/ResourceNotFoundError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
x-codeSamples:
- lang: Shell
label: 'cURL: Update a DBRP mapping'
source: |
curl --request PATCH \
"http://localhost:8086/api/v2/dbrp/DBRP_ID" \
--header 'Content-type: application/json' \
--header "Authorization: Token INFLUX_API_TOKEN" \
--data-binary @- << EOF
{
"default": true,
"retention_policy": "example_retention_policy_name"
}
EOF
delete:
operationId: DeleteDBRPID
tags:
- DBRPs
summary: Delete a database retention policy
description: |
Deletes the specified database retention policy (DBRP) mapping.
#### Related guide
- [Database and retention policy mapping](https://docs.influxdata.com/influxdb/latest/reference/api/influxdb-1x/dbrp/)
parameters:
- $ref: '#/components/parameters/TraceSpan'
- in: query
name: orgID
description: |
An organization ID.
Specifies the organization that owns the DBRP mapping.
schema:
type: string
- in: query
name: org
description: |
An organization name.
Specifies the organization that owns the DBRP mapping.
schema:
type: string
- in: path
name: dbrpID
schema:
type: string
required: true
description: |
A DBRP mapping ID.
Only returns the specified DBRP mapping.
responses:
'204':
description: Success. The delete is accepted.
'400':
description: Bad Request. Query parameters contain invalid values.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples: