7.3 KiB
title | description | menu | weight | influxdb/v2.1/tags | related | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
InfluxDB 1.x compatibility API | The InfluxDB v2 API includes InfluxDB 1.x compatibility endpoints that work with InfluxDB 1.x client libraries and third-party integrations like [Grafana](https://grafana.com) and others. |
|
104 |
|
|
The InfluxDB v2 API includes InfluxDB 1.x compatibility endpoints that work with InfluxDB 1.x client libraries and third-party integrations like Grafana and others.
View full v1 compatibility API documentation
Authentication
InfluxDB 1.x compatibility endpoints require all query and write requests to be authenticated with an API token or 1.x-compatible credentials.
Authenticate with the Token scheme
Token authentication requires the following credential:
- token: InfluxDB API token
Use the Authorization
header with the Token
scheme to provide your token to InfluxDB.
Syntax
Authorization: Token INFLUX_API_TOKEN
Example
{{< code-tabs-wrapper >}} {{% code-tabs %}} curl Node.js {{% /code-tabs %}} {{% code-tab-content %}}
{{% get-shared-text "api/v1-compat/auth/oss/token-auth.sh" %}}
{{% /code-tab-content %}} {{% code-tab-content %}}
{{% get-shared-text "api/v1-compat/auth/oss/token-auth.js" %}}
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}}
Authenticate with a username and password scheme
Use the following authentication schemes with clients that support the InfluxDB 1.x convention of username
and password
(that don't support the Authorization: Token
scheme):
Manage credentials
{{% oss-only %}}
Username and password schemes require the following credentials:
- username: 1.x username (this is separate from the UI login username)
- password: 1.x password or InfluxDB API token.
{{% note %}}
Password or Token
If you have set a password for the 1.x-compatible username, provide the 1.x-compatible password. If you haven't set a password for the 1.x-compatible username, provide the InfluxDB authentication token as the password. {{% /note %}}
For information about creating and managing 1.x-compatible authorizations, see:
{{% /oss-only %}}
{{% cloud-only %}}
- username: InfluxDB Cloud username
(Use the email address you signed up with as your username, e.g.
exampleuser@influxdata.com
.) - password: InfluxDB Cloud API token
{{% /cloud-only %}}
Basic authentication
Use the Authorization
header with the Basic
scheme to provide username and
password credentials to InfluxDB.
{{% api/v1-compat/basic-auth-syntax %}}
Syntax
{{% oss-only %}}
Authorization: Basic INFLUX_USERNAME:INFLUX_PASSWORD_OR_TOKEN
{{% /oss-only %}}
{{% cloud-only %}}
Authorization: Basic exampleuser@influxdata.com:INFLUX_API_TOKEN
{{% /cloud-only %}}
Example
{{% oss-only %}}
{{< code-tabs-wrapper >}} {{% code-tabs %}} curl Node.js {{% /code-tabs %}} {{% code-tab-content %}}
{{% get-shared-text "api/v1-compat/auth/oss/basic-auth.sh" %}}
{{% /code-tab-content %}} {{% code-tab-content %}}
{{% get-shared-text "api/v1-compat/auth/oss/basic-auth.js" %}}
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}}
{{% /oss-only %}}
{{% cloud-only %}}
{{< code-tabs-wrapper >}} {{% code-tabs %}} curl Node.js {{% /code-tabs %}} {{% code-tab-content %}}
{{% get-shared-text "api/v1-compat/auth/cloud/basic-auth.sh" %}}
{{% /code-tab-content %}}
{{% code-tab-content %}}
{{% get-shared-text "api/v1-compat/auth/cloud/basic-auth.js" %}}
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}}
Replace the following:
exampleuser@influxdata.com
: the email address that you signed up withINFLUX_API_TOKEN
: your InfluxDB API token
{{% /cloud-only %}}
Query string authentication
Use InfluxDB 1.x API parameters to provide credentials through the query string.
{{% note %}}
Consider when using query string parameters
- URL-encode query parameters that may contain whitespace or other special characters.
- Be aware of the risks when exposing sensitive data through URLs. {{% /note %}}
Syntax
{{% oss-only %}}
/query/?u=INFLUX_USERNAME&p=INFLUX_PASSWORD_OR_TOKEN
/write/?u=INFLUX_USERNAME&p=INFLUX_PASSWORD_OR_TOKEN
{{% /oss-only %}}
{{% cloud-only %}}
/query/?u=INFLUX_USERNAME&p=INFLUX_API_TOKEN
/write/?u=INFLUX_USERNAME&p=INFLUX_API_TOKEN
{{% /cloud-only %}}
Example
{{% oss-only %}} {{< code-tabs-wrapper >}} {{% code-tabs %}} curl Node.js {{% /code-tabs %}} {{% code-tab-content %}}
{{< get-shared-text "api/v1-compat/auth/oss/querystring-auth.sh" >}}
{{% /code-tab-content %}} {{% code-tab-content %}}
{{< get-shared-text "api/v1-compat/auth/oss/querystring-auth.js" >}}
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}}
Replace the following:
INFLUX_USERNAME
: InfluxDB 1.x usernameINFLUX_PASSWORD_OR_TOKEN
: InfluxDB 1.x password or InfluxDB API token
{{% /oss-only %}}
{{% cloud-only %}}
{{< code-tabs-wrapper >}} {{% code-tabs %}} curl Node.js {{% /code-tabs %}} {{% code-tab-content %}}
{{% get-shared-text "api/v1-compat/auth/cloud/basic-auth.sh" %}}
{{% /code-tab-content %}}
{{% code-tab-content %}}
{{% get-shared-text "api/v1-compat/auth/cloud/basic-auth.js" %}}
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}}
Replace the following:
exampleuser@influxdata.com
: the email address that you signed up withINFLUX_API_TOKEN
: your InfluxDB API token
{{% /cloud-only %}}
InfluxQL support
The compatibility API supports InfluxQL, with the following caveats:
- The
INTO
clause (e.g.SELECT ... INTO ...
) is not supported. - With the exception of [
DELETE
](/{{< latest "influxdb" "v1" >}}/query_language/manage-database/#delete-series-with-delete) and [DROP MEASUREMENT
](/{{< latest "influxdb" "v1" >}}/query_language/manage-database/#delete-measurements-with-drop-measurement) queries, which are still allowed, InfluxQL database management commands are not supported.
Compatibility endpoints
{{< children readmore=true >}}