postWrite method
Write data
Writes data to a bucket. To write data into InfluxDB, you need the following: - organization – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See 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
andorg
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 code413
. -
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
andorg
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));
}
}