postWrite method

Future<void> postWrite(
  1. String org,
  2. String bucket,
  3. String body, {
  4. String? zapTraceSpan,
  5. String? contentEncoding,
  6. String? contentType,
  7. int? contentLength,
  8. String? accept,
  9. String? orgID,
  10. WritePrecision? precision,
})

Write data

Writes data to a bucket. To write data into InfluxDB, you need the following: - organizationSee View organizations for instructions on viewing your organization ID. - bucketSee View buckets for instructions on viewing your bucket ID. - API tokenSee View tokens for instructions on viewing your API token. - InfluxDB URLSee InfluxDB URLs. - data in line protocol format. For more information and examples, see Write data with the InfluxDB API.

Parameters:

  • String org (required): The parameter value specifies the 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.

  • String bucket (required): The destination bucket for writes.

  • String body (required): Data in line protocol format.

  • String zapTraceSpan: OpenTracing span context

  • String contentEncoding: When present, the header value tells the database that compression is applied to the line protocol in the request body.

  • String contentType: The header value indicates the format of the data in the request body.

  • int contentLength: The header value indicates the 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.

  • String accept: The header value specifies the response format.

  • String orgID: The parameter value specifies the ID of the destination organization for writes. If both orgID and org are specified, org takes precedence.

  • WritePrecision precision: The precision for the unix timestamps within the body line-protocol.

Implementation

Future<void> postWrite(String org, String bucket, String body,
    {String? zapTraceSpan,
    String? contentEncoding,
    String? contentType,
    int? contentLength,
    String? accept,
    String? orgID,
    WritePrecision? precision}) async {
  final response = await postWriteWithHttpInfo(org, bucket, body,
      zapTraceSpan: zapTraceSpan,
      contentEncoding: contentEncoding,
      contentType: contentType,
      contentLength: contentLength,
      accept: accept,
      orgID: orgID,
      precision: precision);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
}