Interface WriteService


public interface WriteService
  • Method Details

    • postWrite

      @Headers("Content-Type:text/plain") @POST("api/v2/write") retrofit2.Call<Void> postWrite(@Query("org") String org, @Query("bucket") String bucket, @Body String body, @Header("Zap-Trace-Span") String zapTraceSpan, @Header("Content-Encoding") String contentEncoding, @Header("Content-Type") String contentType, @Header("Content-Length") Integer contentLength, @Header("Accept") String accept, @Query("orgID") String orgID, @Query("precision") WritePrecision precision, @Query("consistency") WriteConsistency consistency)
      Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - **organization name or ID** – _See [View organizations](https://docs.influxdata.com/influxdb/v2.1/organizations/view-orgs/#view-your-organization-id) for instructions on viewing your organization ID._ - **bucket** – _See [View buckets](https://docs.influxdata.com/influxdb/v2.1/organizations/buckets/view-buckets/) for instructions on viewing your bucket ID._ - **API token** – _See [View tokens](https://docs.influxdata.com/influxdb/v2.1/security/tokens/view-tokens/) for instructions on viewing your API token._ - **InfluxDB URL** – _See [InfluxDB URLs](https://docs.influxdata.com/influxdb/v2.1/reference/urls/)_. - data in [line protocol](https://docs.influxdata.com/influxdb/v2.1/reference/syntax/line-protocol) format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - [Write data with the InfluxDB API](https://docs.influxdata.com/influxdb/v2.1/write-data/developer-tools/api). - [Optimize writes to InfluxDB](https://docs.influxdata.com/influxdb/v2.1/write-data/best-practices/optimize-writes/). - [Troubleshoot issues writing data](https://docs.influxdata.com/influxdb/v2.1/write-data/troubleshoot/)
      Parameters:
      org - Destination organization for writes. The database writes all points in the batch to this organization. If you provide both `orgID` and `org` parameters, `org` takes precedence. (required)
      bucket - Destination bucket for writes. (required)
      body - Data in line protocol format. (required)
      zapTraceSpan - OpenTracing span context (optional)
      contentEncoding - The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send `Content-Encoding: gzip` as a request header. (optional, default to identity)
      contentType - Format of the data in the request body. To make an API request with a line protocol payload, send `Content-Type: text/plain; charset=utf-8` as a request header. (optional, default to text/plain; charset=utf-8)
      contentLength - Size of the entity-body, in bytes, sent to the database. If the length is greater than the database's `max body` configuration option, the server responds with status code `413`. (optional)
      accept - Content type that the client can understand. Writes only return a response body if they fail, e.g. due to a formatting problem or quota limit. #### InfluxDB Cloud - returns only `application/json` for format and limit errors. - returns only `text/html` for some quota limit errors. #### InfluxDB OSS - returns only `application/json` for format and limit errors. For more information about write errors, see how to [troubleshoot issues writing data](https://docs.influxdata.com/influxdb/v2.1/write-data/troubleshoot/). (optional, default to application/json)
      orgID - ID of the destination organization for writes. If both `orgID` and `org` are specified, `org` takes precedence. (optional)
      precision - Precision for unix timestamps in the line protocol of the request payload. (optional, default to null)
      consistency - Sets the write consistency for the point. InfluxDB assumes that the write consistency is 'one' if you do not specify. Available with InfluxDB Enterprise clusters only. (optional, default to null)
      Returns:
      Call<Void>
    • postWriteRx

      @POST("api/v2/write") io.reactivex.rxjava3.core.Single<retrofit2.Response<Void>> postWriteRx(@Query("org") String org, @Query("bucket") String bucket, @Body String body, @Header("Zap-Trace-Span") String zapTraceSpan, @Header("Content-Encoding") String contentEncoding, @Header("Content-Type") String contentType, @Header("Content-Length") Integer contentLength, @Header("Accept") String accept, @Query("orgID") String orgID, @Query("precision") WritePrecision precision, @Query("consistency") WriteConsistency consistency)
      Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - **organization name or ID** – _See [View organizations](https://docs.influxdata.com/influxdb/v2.1/organizations/view-orgs/#view-your-organization-id) for instructions on viewing your organization ID._ - **bucket** – _See [View buckets](https://docs.influxdata.com/influxdb/v2.1/organizations/buckets/view-buckets/) for instructions on viewing your bucket ID._ - **API token** – _See [View tokens](https://docs.influxdata.com/influxdb/v2.1/security/tokens/view-tokens/) for instructions on viewing your API token._ - **InfluxDB URL** – _See [InfluxDB URLs](https://docs.influxdata.com/influxdb/v2.1/reference/urls/)_. - data in [line protocol](https://docs.influxdata.com/influxdb/v2.1/reference/syntax/line-protocol) format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - [Write data with the InfluxDB API](https://docs.influxdata.com/influxdb/v2.1/write-data/developer-tools/api). - [Optimize writes to InfluxDB](https://docs.influxdata.com/influxdb/v2.1/write-data/best-practices/optimize-writes/). - [Troubleshoot issues writing data](https://docs.influxdata.com/influxdb/v2.1/write-data/troubleshoot/)
      Parameters:
      org - Destination organization for writes. The database writes all points in the batch to this organization. If you provide both `orgID` and `org` parameters, `org` takes precedence. (required)
      bucket - Destination bucket for writes. (required)
      body - Data in line protocol format. (required)
      zapTraceSpan - OpenTracing span context (optional)
      contentEncoding - The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send `Content-Encoding: gzip` as a request header. (optional, default to identity)
      contentType - Format of the data in the request body. To make an API request with a line protocol payload, send `Content-Type: text/plain; charset=utf-8` as a request header. (optional, default to text/plain; charset=utf-8)
      contentLength - Size of the entity-body, in bytes, sent to the database. If the length is greater than the database's `max body` configuration option, the server responds with status code `413`. (optional)
      accept - Content type that the client can understand. Writes only return a response body if they fail, e.g. due to a formatting problem or quota limit. #### InfluxDB Cloud - returns only `application/json` for format and limit errors. - returns only `text/html` for some quota limit errors. #### InfluxDB OSS - returns only `application/json` for format and limit errors. For more information about write errors, see how to [troubleshoot issues writing data](https://docs.influxdata.com/influxdb/v2.1/write-data/troubleshoot/). (optional, default to application/json)
      orgID - ID of the destination organization for writes. If both `orgID` and `org` are specified, `org` takes precedence. (optional)
      precision - Precision for unix timestamps in the line protocol of the request payload. (optional, default to null)
      consistency - Sets the write consistency for the point. InfluxDB assumes that the write consistency is 'one' if you do not specify. Available with InfluxDB Enterprise clusters only. (optional, default to null)
      Returns:
      Single<Response<Void>>