@@ -51,6 +51,8 @@ After you
51
51
can use the token string to authenticate ` influxdb3 ` commands and HTTP API requests
52
52
for managing database and system tokens.
53
53
54
+ The HTTP API examples in this guide use [ cURL] ( https://curl.se/ ) to send an API request, but you can use any HTTP client._
55
+
54
56
> [ !Note]
55
57
> #### Store secure tokens in a secret store
56
58
>
@@ -75,17 +77,17 @@ your {{% product-name %}} instance.
75
77
76
78
In your terminal, run the ` influxdb3 create token ` command and provide the following:
77
79
78
- - `--permission` flag to create a token with permissions
79
- - `--name` flag with a unique description of the token
80
- - _Options_, for example:
81
- - `--expiry` option with the token expiration time as a [duration](/influxdb3/enterprise/reference/glossary/#duration).
82
- If an expiration isn't set, the token does not expire until revoked.
83
- - Token permissions (read and write) in the Permission in the `RESOURCE_TYPE:RESOURCE_NAMES:ACTIONS` format--for example:
84
- - db:DATABASE1,DATABASE2:read,write
85
- - `db:`: The `db` resource type, which specifies the token is for a database.
86
- - `DATABASE1,DATABASE2`: The names of the databases to grant permissions to.
87
- The resource names part supports the `*` wildcard, which grants read or write permissions to all databases.
88
- - `read,write`: The permissions to grant to the token.
80
+ - ` --permission ` flag to create a token with permissions
81
+ - ` --name ` flag with a unique description of the token
82
+ - _ Options_ , for example:
83
+ - ` --expiry ` option with the token expiration time as a [ duration] ( /influxdb3/enterprise/reference/glossary/#duration ) .
84
+ If an expiration isn't set, the token does not expire until revoked.
85
+ - Token permissions (read and write) in the ` RESOURCE_TYPE:RESOURCE_NAMES:ACTIONS ` format--for example:
86
+ - db: DATABASE1 ,DATABASE2: read ,write
87
+ - ` db: ` : The ` db ` resource type, which specifies the token is for a database.
88
+ - ` DATABASE1,DATABASE2 ` : The names of the databases to grant permissions to.
89
+ The resource names part supports the ` * ` wildcard, which grants read or write permissions to all databases.
90
+ - ` read,write ` : The permissions to grant to the token.
89
91
90
92
{{% code-placeholders "DATABASE1|DATABASE2|1y" %}}
91
93
@@ -113,29 +115,27 @@ The output is the token string in plain text.
113
115
{{% /tab-content %}}
114
116
{{% tab-content %}}
115
117
<!-- ----------------------------- BEGIN cURL ---------------------------------->
116
- _ This example uses [ cURL] ( https://curl.se/ ) to send an HTTP API request, but you can use any HTTP client._
117
118
118
- 1 . If you haven't already, follow the instructions to [ install cURL] ( https://everything.curl.dev/install/index.html ) for your system.
119
- 2 . In your terminal, use cURL to send a request to the following {{% product-name %}} endpoint:
119
+ Send a request to the following {{% product-name %}} endpoint:
120
120
121
- {{% api-endpoint endpoint="http://{{< influxdb/host >}}/api/v3/enterprise/configure/token" method="post" %}}
121
+ {{% api-endpoint endpoint="http://{{< influxdb/host >}}/api/v3/enterprise/configure/token" method="post" %}}
122
122
123
- Provide the following request headers:
123
+ Provide the following request headers:
124
124
125
- - ` Accept: application/json ` to ensure the response body is JSON content
126
- - ` Content-Type: application/json ` to indicate the request body is JSON content
127
- - ` Authorization: Bearer ` and the [ admin token] ( /influxdb3/enterprise/admin/tokens/admin/ )
128
- for your instance to authorize the request
125
+ - ` Accept: application/json ` to ensure the response body is JSON content
126
+ - ` Content-Type: application/json ` to indicate the request body is JSON content
127
+ - ` Authorization: Bearer ` and the [ admin token] ( /influxdb3/enterprise/admin/tokens/admin/ )
128
+ for your instance to authorize the request
129
129
130
- In the request body, provide the following parameters:
130
+ In the request body, provide the following parameters:
131
131
132
- - ` token_name ` : a description of the token, unique within the instance
133
- - ` resource_type ` : the resource type for the token, which is always ` db `
134
- - ` resource_identifier ` : an array of database names to grant permissions to
135
- - The resource identifier field supports the ` * ` wildcard, which grants read or write
136
- permissions to all databases.
137
- - ` permissions ` : an array of token permission actions (` "read" ` , ` "write" ` ) for the database
138
- - ` expiry_secs ` : Specify the token expiration time in seconds.
132
+ - ` token_name ` : a description of the token, unique within the instance
133
+ - ` resource_type ` : the resource type for the token, which is always ` db `
134
+ - ` resource_identifier ` : an array of database names to grant permissions to
135
+ - The resource identifier field supports the ` * ` wildcard, which grants read or write
136
+ permissions to all databases.
137
+ - ` permissions ` : an array of token permission actions (` "read" ` , ` "write" ` ) for the database
138
+ - ` expiry_secs ` : Specify the token expiration time in seconds.
139
139
140
140
The following example shows how to use the HTTP API to create a database token:
141
141
@@ -444,29 +444,26 @@ The output is the token string in plain text.
444
444
{{% /tab-content %}}
445
445
{{% tab-content %}}
446
446
<!-- ----------------------------- BEGIN cURL ---------------------------------->
447
- _ This example uses [ cURL] ( https://curl.se/ ) to send an HTTP API request, but you can use any HTTP client._
448
-
449
- 1 . If you haven't already, follow the instructions to [ install cURL] ( https://everything.curl.dev/install/index.html ) for your system.
450
- 2 . In your terminal, use cURL to send a request to the following {{% product-name %}} endpoint:
447
+ Send a request to the following {{% product-name %}} endpoint:
451
448
452
- {{% api-endpoint endpoint="http://{{< influxdb/host >}}/api/v3/enterprise/configure/token" method="post" %}}
449
+ {{% api-endpoint endpoint="http://{{< influxdb/host >}}/api/v3/enterprise/configure/token" method="post" %}}
453
450
454
- Provide the following request headers:
451
+ Provide the following request headers:
455
452
456
- - ` Accept: application/json ` to ensure the response body is JSON content
457
- - ` Content-Type: application/json ` to indicate the request body is JSON content
458
- - ` Authorization: Bearer ` and the [ admin token] ( /influxdb3/enterprise/admin/tokens/admin/ )
459
- for your instance to authorize the request
453
+ - ` Accept: application/json ` to ensure the response body is JSON content
454
+ - ` Content-Type: application/json ` to indicate the request body is JSON content
455
+ - ` Authorization: Bearer ` and the [ admin token] ( /influxdb3/enterprise/admin/tokens/admin/ )
456
+ for your instance to authorize the request
460
457
461
- In the request body, provide the following parameters:
458
+ In the request body, provide the following parameters:
462
459
463
- - ` token_name ` : a description of the token, unique within the instance
464
- - ` resource_type ` : the resource type for the token, which is ` system ` for system tokens
465
- - ` resource_identifier ` : an array of system resource names to grant permissions to
466
- - The resource identifier field supports the ` * ` wildcard, which grants read or write
467
- permissions to all system information resources.
468
- - ` permissions ` : an array of token permission actions (only ` "read" ` for system tokens)
469
- - ` expiry_secs ` : Specify the token expiration time in seconds.
460
+ - ` token_name ` : a description of the token, unique within the instance
461
+ - ` resource_type ` : the resource type for the token, which is ` system ` for system tokens
462
+ - ` resource_identifier ` : an array of system resource names to grant permissions to
463
+ - The resource identifier field supports the ` * ` wildcard, which grants read or write
464
+ permissions to all system information resources.
465
+ - ` permissions ` : an array of token permission actions (only ` "read" ` for system tokens)
466
+ - ` expiry_secs ` : Specify the token expiration time in seconds.
470
467
471
468
The following example shows how to use the HTTP API to create a system token:
472
469
0 commit comments