{"id":20260002,"url":"https://github.com/influxdata/influxdb-client-java","last_synced_at":"2026-01-16T06:33:36.949Z","repository":{"id":37693507,"uuid":"151233646","full_name":"influxdata/influxdb-client-java","owner":"influxdata","description":"InfluxDB 2 JVM Based Clients","archived":false,"fork":false,"pushed_at":"2026-01-13T10:24:19.000Z","size":168098,"stargazers_count":474,"open_issues_count":43,"forks_count":132,"subscribers_count":36,"default_branch":"master","last_synced_at":"2026-01-13T12:02:08.065Z","etag":null,"topics":["flux","influxdata","influxdb","java","reactive","rxjava","timeseries"],"latest_commit_sha":null,"homepage":"https://influxdata.github.io/influxdb-client-java/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/influxdata.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-10-02T09:53:01.000Z","updated_at":"2026-01-13T10:24:23.000Z","dependencies_parsed_at":"2024-05-01T21:32:02.267Z","dependency_job_id":"24021f19-6271-4159-819e-364d69ec4093","html_url":"https://github.com/influxdata/influxdb-client-java","commit_stats":{"total_commits":1048,"total_committers":34,"mean_commits":"30.823529411764707","dds":0.316793893129771,"last_synced_commit":"f9283d6d1154a02528c5e28504162c917b2073e4"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"purl":"pkg:github/influxdata/influxdb-client-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/influxdata","download_url":"https://codeload.github.com/influxdata/influxdb-client-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-client-java/sbom","scorecard":{"id":488152,"data":{"date":"2025-08-11","repo":{"name":"github.com/influxdata/influxdb-client-java","commit":"6e977d7c622ad98848a1e0c0d7d68f10cf493fcc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Maintained","score":5,"reason":"7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/semantic.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":2,"reason":"Found 2/7 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/semantic.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/influxdata/influxdb-client-java/semantic.yml/master?enable=pin","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6v67-2wr5-gvf4","Warn: Project is vulnerable to: GHSA-pr98-23f8-jwxv","Warn: Project is vulnerable to: GHSA-h46c-h94j-95f3","Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T18:20:24.199Z","repository_id":37693507,"created_at":"2025-08-19T18:20:24.199Z","updated_at":"2025-08-19T18:20:24.199Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flux","influxdata","influxdb","java","reactive","rxjava","timeseries"],"created_at":"2024-11-14T11:17:35.276Z","updated_at":"2026-01-16T06:33:36.940Z","avatar_url":"https://github.com/influxdata.png","language":"Java","readme":"# influxdb-client-java\n\n[![CircleCI](https://circleci.com/gh/influxdata/influxdb-client-java.svg?style=svg)](https://circleci.com/gh/influxdata/influxdb-client-java)\n[![codecov](https://codecov.io/gh/influxdata/influxdb-client-java/branch/master/graph/badge.svg)](https://codecov.io/gh/influxdata/influxdb-client-java)\n[![License](https://img.shields.io/github/license/influxdata/influxdb-client-java.svg)](https://github.com/influxdata/influxdb-client-java/blob/master/LICENSE)\n[![Maven Central](https://img.shields.io/maven-central/v/com.influxdb/influxdb-client)](https://repo1.maven.org/maven2/com/influxdb/)\n[![Maven Site](https://img.shields.io/badge/maven-site-blue)](https://influxdata.github.io/influxdb-client-java/)\n[![GitHub issues](https://img.shields.io/github/issues-raw/influxdata/influxdb-client-java.svg)](https://github.com/influxdata/influxdb-client-java/issues)\n[![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/influxdata/influxdb-client-java.svg)](https://github.com/influxdata/influxdb-client-java/pulls)\n[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack\u0026style=social)](https://www.influxdata.com/slack)\n\nThis repository contains the Java client library for use with InfluxDB 2.x and Flux. Currently, Java, Reactive, Kotlin and Scala clients are implemented. InfluxDB 3.x users should instead use the lightweight [v3 client library](https://github.com/InfluxCommunity/influxdb3-java). InfluxDB 1.x users should use the [v1 client library](https://github.com/influxdata/influxdb-java).\n\nFor ease of migration and a consistent query and write experience, v2 users should consider using InfluxQL and the [v1 client library](https://github.com/influxdata/influxdb-java).\n\n- [Features](#features)\n- [Clients](#clients)\n- [How To Use](#how-to-use)\n    - [Writes and Queries in InfluxDB 2.x](#writes-and-queries-in-influxdb-2x)\n    - [Use Management API to create a new Bucket in InfluxDB 2.x](#use-management-api-to-create-a-new-bucket-in-influxdb-2x)\n    - [Flux queries in InfluxDB 1.7+](#flux-queries-in-influxdb-17)\n- [Build Requirements](#build-requirements)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Documentation\n\nThis section contains links to the client library documentation.\n\n* [Product documentation](https://docs.influxdata.com/influxdb/v2.x/api-guide/client-libraries/), [Getting Started](#how-to-use)\n* [Examples](examples)\n* [API Reference](https://influxdata.github.io/influxdb-client-java/influxdb-client-java/apidocs/index.html)\n* [Changelog](CHANGELOG.md)\n\n## Features\n\n- InfluxDB 2.x client\n    - Querying data using the Flux language\n    - Querying data using the InfluxQL\n    - Writing data using\n        - [Line Protocol](https://docs.influxdata.com/influxdb/v1.6/write_protocols/line_protocol_tutorial/)\n        - [Data Point](https://github.com/influxdata/influxdb-client-java/blob/master/client/src/main/java/org/influxdata/client/write/Point.java#L46)\n        - POJO\n    - InfluxDB 2.x Management API client for managing\n        - sources, buckets\n        - tasks\n        - authorizations\n        - health check\n        - ...\n- Supports querying using the Flux language over the InfluxDB 1.7+ REST API (`/api/v2/query endpoint`)\n\n## Clients\n\nThe Java, Reactive, OSGi, Kotlin and Scala clients are implemented for the InfluxDB 2.x:\n\n| Client                            | Description                                                                                                                                                                                                                                                                                                                                                | Documentation                                                                                                                                                                                               | Compatibility |\n|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| **[java](./client)**              | The reference Java client that allows query, write and InfluxDB 2.x management.                                                                                                                                                                                                                                                                            | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-java/apidocs/index.html), [readme](./client#influxdb-client-java/)                                                              | 2.x           |\n| **[reactive](./client-reactive)** | The reference RxJava client for the InfluxDB 2.x that allows query and write in a reactive way.                                                                                                                                                                                                                                                            | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-reactive/apidocs/index.html), [readme](./client-reactive#influxdb-client-reactive/)                                             | 2.x           |\n| **[kotlin](./client-kotlin)**     | The reference Kotlin client that allows query and write for the InfluxDB 2.x by Kotlin [Channel](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-channel/index.html) and [Flow](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html) coroutines. | [KDoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-kotlin/dokka/influxdb-client-kotlin/com.influxdb.client.kotlin/index.html), [readme](./client-kotlin#influxdb-client-kotlin/)      | 2.x           |\n| **[scala](./client-scala)**       | The reference Scala client that allows query and write for the InfluxDB 2.x by [Pekko Streams](https://pekko.apache.org/docs/pekko/current/stream/index.html).                                                                                                                                                                                             | [Scaladoc](https://influxdata.github.io/influxdb-client-java/client-scala/cross/influxdb-client-scala_2.13/scaladocs/com/influxdb/client/scala/index.html), [readme](./client-scala#influxdb-client-scala/) | 2.x           |\n| **[osgi](./client-osgi)**         | The reference OSGi (R6) client embedding Java and reactive clients and providing standard features (declarative services, configuration, event processing) for the InfluxDB 2.x.                                                                                                                                                                           | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-osgi/apidocs/index.html), [readme](./client-osgi)                                                                               | 2.x           |\n| **[karaf](./karaf)**              | The Apache Karaf feature definition for the InfluxDB 2.x.                                                                                                                                                                                                                                                                                                  | [readme](./karaf)                                                                                                                                                                                           | 2.x           |\n\nThere is also possibility to use the Flux language over the InfluxDB 1.7+ provided by:\n\n| Client | Description | Documentation | Compatibility |\n| --- | --- | --- |                                      --- |\n| **[flux](./client-legacy)** | The reference Java client that allows you to perform Flux queries against InfluxDB 1.7+. | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-flux/apidocs/index.html), [readme](./client-legacy#influxdb-client-flux/) | 1.7+ |\n\nThe last useful part is  **[flux-dsl](./flux-dsl)** that helps construct Flux query by Query builder pattern:\n\n```java\nFlux flux = Flux\n    .from(\"telegraf\")\n    .window(15L, ChronoUnit.MINUTES, 20L, ChronoUnit.SECONDS)\n    .sum();\n```\n\n| Module | Description | Documentation | Compatibility |\n| --- | --- | --- |                                      --- |\n| **[flux-dsl](./flux-dsl)** | A Java query builder for the Flux language | [javadoc](https://influxdata.github.io/influxdb-client-java/flux-dsl/apidocs/index.html), [readme](./flux-dsl#flux-dsl/)| 1.7+, 2.x |\n\n\n## How To Use\n\nThis clients are hosted in Maven central Repository.\n\nIf you want to use it with the Maven, you have to add only the dependency on the artifact.\n\n### Writes and Queries in InfluxDB 2.x\n\nThe following example demonstrates how to write data to InfluxDB 2.x and read them back using the Flux language.\n\n#### Installation\n\nDownload the latest version:\n\n##### Maven dependency:\n\n```XML\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.influxdb\u003c/groupId\u003e\n    \u003cartifactId\u003einfluxdb-client-java\u003c/artifactId\u003e\n    \u003cversion\u003e7.5.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n##### Or when using Gradle:\n\n```groovy\ndependencies {\n    implementation \"com.influxdb:influxdb-client-java:7.5.0\"\n}\n```\n\n```java\npackage example;\n\nimport java.time.Instant;\nimport java.util.List;\n\nimport com.influxdb.annotations.Column;\nimport com.influxdb.annotations.Measurement;\nimport com.influxdb.client.InfluxDBClient;\nimport com.influxdb.client.InfluxDBClientFactory;\nimport com.influxdb.client.QueryApi;\nimport com.influxdb.client.WriteApiBlocking;\nimport com.influxdb.client.domain.WritePrecision;\nimport com.influxdb.client.write.Point;\nimport com.influxdb.query.FluxRecord;\nimport com.influxdb.query.FluxTable;\n\npublic class InfluxDB2Example {\n\n    private static char[] token = \"my-token\".toCharArray();\n    private static String org = \"my-org\";\n    private static String bucket = \"my-bucket\";\n\n    public static void main(final String[] args) {\n\n        InfluxDBClient influxDBClient = InfluxDBClientFactory.create(\"http://localhost:8086\", token, org, bucket);\n\n        //\n        // Write data\n        //\n        WriteApiBlocking writeApi = influxDBClient.getWriteApiBlocking();\n\n        //\n        // Write by Data Point\n        //\n        Point point = Point.measurement(\"temperature\")\n                .addTag(\"location\", \"west\")\n                .addField(\"value\", 55D)\n                .time(Instant.now().toEpochMilli(), WritePrecision.MS);\n\n        writeApi.writePoint(point);\n\n        //\n        // Write by LineProtocol\n        //\n        writeApi.writeRecord(WritePrecision.NS, \"temperature,location=north value=60.0\");\n\n        //\n        // Write by POJO\n        //\n        Temperature temperature = new Temperature();\n        temperature.location = \"south\";\n        temperature.value = 62D;\n        temperature.time = Instant.now();\n\n        writeApi.writeMeasurement( WritePrecision.NS, temperature);\n\n        //\n        // Query data\n        //\n        String flux = \"from(bucket:\\\"my-bucket\\\") |\u003e range(start: 0)\";\n\n        QueryApi queryApi = influxDBClient.getQueryApi();\n\n        List\u003cFluxTable\u003e tables = queryApi.query(flux);\n        for (FluxTable fluxTable : tables) {\n            List\u003cFluxRecord\u003e records = fluxTable.getRecords();\n            for (FluxRecord fluxRecord : records) {\n                System.out.println(fluxRecord.getTime() + \": \" + fluxRecord.getValueByKey(\"_value\"));\n            }\n        }\n\n        influxDBClient.close();\n    }\n\n    @Measurement(name = \"temperature\")\n    private static class Temperature {\n\n        @Column(tag = true)\n        String location;\n\n        @Column\n        Double value;\n\n        @Column(timestamp = true)\n        Instant time;\n    }\n}\n```\n\n### Use Management API to create a new Bucket in InfluxDB 2.x\n\nThe following example demonstrates how to use a InfluxDB 2.x Management API. For further information see [client documentation](./client#management-api).\n\n#### Installation\n\nDownload the latest version:\n\n##### Maven dependency:\n\n```XML\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.influxdb\u003c/groupId\u003e\n    \u003cartifactId\u003einfluxdb-client-java\u003c/artifactId\u003e\n    \u003cversion\u003e7.5.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n##### Or when using Gradle:\n\n```groovy\ndependencies {\n    implementation \"com.influxdb:influxdb-client-java:7.5.0\"\n}\n```\n\n```java\npackage example;\n\nimport java.util.Arrays;\n\nimport com.influxdb.client.InfluxDBClient;\nimport com.influxdb.client.InfluxDBClientFactory;\nimport com.influxdb.client.domain.Authorization;\nimport com.influxdb.client.domain.Bucket;\nimport com.influxdb.client.domain.Permission;\nimport com.influxdb.client.domain.PermissionResource;\nimport com.influxdb.client.domain.BucketRetentionRules;\n\npublic class InfluxDB2ManagementExample {\n\n    private static char[] token = \"my-token\".toCharArray();\n\n    public static void main(final String[] args) {\n\n        InfluxDBClient influxDBClient = InfluxDBClientFactory.create(\"http://localhost:8086\", token);\n\n        //\n        // Create bucket \"iot_bucket\" with data retention set to 3,600 seconds\n        //\n        BucketRetentionRules retention = new BucketRetentionRules();\n        retention.setEverySeconds(3600);\n\n        Bucket bucket = influxDBClient.getBucketsApi().createBucket(\"iot-bucket\", retention, \"12bdc4164c2e8141\");\n\n        //\n        // Create access token to \"iot_bucket\"\n        //\n        PermissionResource resource = new PermissionResource();\n        resource.setId(bucket.getId());\n        resource.setOrgID(\"12bdc4164c2e8141\");\n        resource.setType(PermissionResource.TYPE_BUCKETS);\n\n        // Read permission\n        Permission read = new Permission();\n        read.setResource(resource);\n        read.setAction(Permission.ActionEnum.READ);\n\n        // Write permission\n        Permission write = new Permission();\n        write.setResource(resource);\n        write.setAction(Permission.ActionEnum.WRITE);\n\n        Authorization authorization = influxDBClient.getAuthorizationsApi()\n                .createAuthorization(\"12bdc4164c2e8141\", Arrays.asList(read, write));\n\n        //\n        // Created token that can be use for writes to \"iot_bucket\"\n        //\n        String token = authorization.getToken();\n        System.out.println(\"Token: \" + token);\n\n        influxDBClient.close();\n    }\n}\n```\n\n### InfluxDB 1.8 API compatibility\n\n[InfluxDB 1.8.0 introduced forward compatibility APIs](https://docs.influxdata.com/influxdb/v1.8/tools/api/#influxdb-2-0-api-compatibility-endpoints) for InfluxDB 2.x. This allow you to easily move from InfluxDB 1.x to InfluxDB 2.x Cloud or open source.\n\nThe following forward compatible APIs are available:\n\n| API | Endpoint | Description |\n|:----------|:----------|:----------|\n| [QueryApi.java](client/src/main/java/com/influxdb/client/QueryApi.java) | [/api/v2/query](https://docs.influxdata.com/influxdb/latest/tools/api/#api-v2-query-http-endpoint) | Query data in InfluxDB 1.8.0+ using the InfluxDB 2.x API and [Flux](https://docs.influxdata.com/flux/latest/) _(endpoint should be enabled by [`flux-enabled` option](https://docs.influxdata.com/influxdb/latest/administration/config/#flux-enabled-false))_  |\n| [WriteApi.java](client/src/main/java/com/influxdb/client/WriteApi.java) | [/api/v2/write](https://docs.influxdata.com/influxdb/latest/tools/api/#api-v2-write-http-endpoint) | Write data to InfluxDB 1.8.0+ using the InfluxDB 2.x API |\n| [health()](client/src/main/java/com/influxdb/client/InfluxDBClient.java#L236) | [/health](https://docs.influxdata.com/influxdb/latest/tools/api/#health-http-endpoint) | Check the health of your InfluxDB instance |\n\nFor detail info see [InfluxDB 1.8 example](examples/src/main/java/example/InfluxDB18Example.java).\n\n### Flux queries in InfluxDB 1.7+\n\nThe following example demonstrates querying using the Flux language.\n\n#### Installation\n\nDownload the latest version:\n\n##### Maven dependency:\n\n```XML\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.influxdb\u003c/groupId\u003e\n    \u003cartifactId\u003einfluxdb-client-flux\u003c/artifactId\u003e\n    \u003cversion\u003e7.5.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n##### Or when using Gradle:\n\n```groovy\ndependencies {\n    implementation \"com.influxdb:influxdb-client-flux:7.5.0\"\n}\n```\n\n```java\npackage example;\n\nimport java.util.List;\n\nimport com.influxdb.client.flux.FluxClient;\nimport com.influxdb.client.flux.FluxClientFactory;\nimport com.influxdb.query.FluxRecord;\nimport com.influxdb.query.FluxTable;\n\npublic class FluxExample {\n\n    public static void main(String[] args) {\n\n        FluxClient fluxClient = FluxClientFactory.create(\"http://localhost:8086/\");\n\n        //\n        // Flux\n        //\n        String flux = \"from(bucket: \\\"telegraf\\\")\\n\" +\n                \" |\u003e range(start: -1d)\" +\n                \" |\u003e filter(fn: (r) =\u003e (r[\\\"_measurement\\\"] == \\\"cpu\\\" and r[\\\"_field\\\"] == \\\"usage_system\\\"))\" +\n                \" |\u003e sample(n: 5, pos: 1)\";\n\n        //\n        // Synchronous query\n        //\n        List\u003cFluxTable\u003e tables = fluxClient.query(flux);\n\n        for (FluxTable fluxTable : tables) {\n            List\u003cFluxRecord\u003e records = fluxTable.getRecords();\n            for (FluxRecord fluxRecord : records) {\n                System.out.println(fluxRecord.getTime() + \": \" + fluxRecord.getValueByKey(\"_value\"));\n            }\n        }\n\n        //\n        // Asynchronous query\n        //\n        fluxClient.query(flux, (cancellable, record) -\u003e {\n\n            // process the flux query result record\n            System.out.println(record.getTime() + \": \" + record.getValue());\n\n        }, error -\u003e {\n\n            // error handling while processing result\n            System.out.println(\"Error occurred: \"+ error.getMessage());\n\n        }, () -\u003e {\n\n            // on complete\n            System.out.println(\"Query completed\");\n        });\n\n        fluxClient.close();\n    }\n}\n```\n\n## Build Requirements\n\n* Java 17+ (tested with JDK 17)\n    * :warning: If you want to use older version of JDK, you have to use the 6.x version of the client.\n* Maven 3.0+ (tested with maven 3.5.0)\n* Docker daemon running\n* The latest InfluxDB 2.x and InfluxDB 1.X docker instances, which can be started using the `./scripts/influxdb-restart.sh` script\n\nOnce these are in place you can build influxdb-client-java with all tests with:\n\n\n```bash\n$ mvn clean install\n```\n\nIf you don't have Docker running locally, you can skip tests with the `-DskipTests` flag set to true:\n\n```bash\n$ mvn clean install -DskipTests=true\n```\n\nIf you have Docker running, but it is not available over localhost (e.g. you are on a Mac and using `docker-machine`) you can set optional environment variables to point to the correct IP addresses and ports:\n\n- `INFLUXDB_IP`\n- `INFLUXDB_PORT_API`\n- `INFLUXDB_2_IP`\n- `INFLUXDB_2_PORT_API`\n- `INFLUXDB_2_ONBOARDING_IP`\n- `INFLUXDB_2_ONBOARDING_PORT`\n\n```bash\n$ export INFLUXDB_IP=192.168.99.100\n$ mvn test\n```\n\n## Contributing\n\nIf you would like to contribute code you can do through GitHub by forking the repository and sending a pull request into the `master` branch.\n\n## License\n\nThe InfluxDB 2.x JVM Based Clients are released under the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdb-client-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfluxdata%2Finfluxdb-client-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdb-client-java/lists"}