From 7ae03927fb051b0bd79927d726d5d711802793ec Mon Sep 17 00:00:00 2001 From: meelahme Date: Mon, 12 May 2025 13:58:30 -0700 Subject: [PATCH] docs(influxdb3): updating code-placeholders and tabbed examples --- content/shared/v3-core-get-started/_index.md | 29 +++++++++++++++++-- .../v3-enterprise-get-started/_index.md | 15 ++++++---- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/content/shared/v3-core-get-started/_index.md b/content/shared/v3-core-get-started/_index.md index f6f3bfa69..079c10b70 100644 --- a/content/shared/v3-core-get-started/_index.md +++ b/content/shared/v3-core-get-started/_index.md @@ -252,15 +252,40 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the To create an admin token, use the `influxdb3 create token --admin` subcommand--for example: +{{% code-placeholders "INFLUXDB_HOST|CONTAINER_NAME" %}} + +{{< code-tabs-wrapper >}} + +{{% code-tabs %}} +[CLI](#) +[Docker](#) +{{% /code-tabs %}} + +{{% code-tab-content %}} ```bash influxdb3 create token --admin \ - --host http://{{< influxdb/host >}} + --host http://INFLUXDB_HOST ``` +{{% /code-tab-content %}} + +{{% code-tab-content %}} + ```bash -# With Docker -- In a new terminal, run: +# With Docker — in a new terminal: docker exec -it CONTAINER_NAME influxdb3 create token --admin ``` +{{% /code-tab-content %}} + +{{< /code-tabs-wrapper >}} + +Replace the following: + +- {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) +- {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container + +{{% /code-placeholders %}} + The command returns a token string that you can use to authenticate CLI commands and API requests. For more information, see how to [Manage admin tokens](/influxdb3/version/admin/tokens/admin/). diff --git a/content/shared/v3-enterprise-get-started/_index.md b/content/shared/v3-enterprise-get-started/_index.md index eafbd5c06..71acde9a5 100644 --- a/content/shared/v3-enterprise-get-started/_index.md +++ b/content/shared/v3-enterprise-get-started/_index.md @@ -309,13 +309,13 @@ docker exec -it CONTAINER_NAME influxdb3 create token --admin {{< /code-tabs-wrapper >}} +{{% /code-placeholders %}} + Replace the following: - {{% code-placeholder-key %}}`INFLUXDB_HOST`{{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, `localhost:8181`) - {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}}: Name of your running Docker container -{{% /code-placeholders %}} - The command returns a token string that you can use to authenticate CLI commands and API requests. After you have created an admin token, you can use it to create database tokens and system tokens. @@ -341,6 +341,7 @@ To create a database token, use the `influxdb3 create token` subcommand and pass The following example shows how to create a database token that expires in 90 days and has read and write permissions for all databases on the server: {{% code-placeholders "ADMIN_TOKEN" %}} + ```bash influxdb3 create token \ --permission \ @@ -401,14 +402,18 @@ For more information, see how to [Manage resource tokens](/influxdb3/version/adm - To authenticate `influxdb3` CLI commands, use the `--token` option or assign your token to the `INFLUXDB3_AUTH_TOKEN` environment variable for `influxdb3` to use it automatically. - To authenticate HTTP API requests, include `Bearer ` in the `Authorization` header value--for example: - + +{{% code-placeholders "SYSTEM_TOKEN" %}} + ```bash curl "http://{{< influxdb/host >}}/health" \ --header "Authorization: Bearer SYSTEM_TOKEN" ``` +{{% /code-placeholders %}} - In your request, replace - {{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}} with the system token you created earlier. +Replace the following: + +In your command, replace {{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}}: System token that grants access to system endpoints (`/health`, `/metrics`, etc.) ### Data model