postQuery method
Query data
Retrieves data from InfluxDB buckets. To query data, you need the following: - organization – See View organizations for instructions on viewing your organization ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - Flux or InfluxQL query. For more information and examples, see Query with the InfluxDB API.
Parameters:
-
String zapTraceSpan: OpenTracing span context
-
String acceptEncoding: The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand.
-
String contentType:
-
String org: Specifies the name of the organization executing the query. Takes either the ID or Name. If both
orgID
andorg
are specified,org
takes precedence. -
String orgID: Specifies the ID of the organization executing the query. If both
orgID
andorg
are specified,org
takes precedence. -
Query query: Flux query or specification to execute
Implementation
Future<String> postQuery(
{String? zapTraceSpan,
String? acceptEncoding,
String? contentType,
String? org,
String? orgID,
required Query query}) async {
final response = await postQueryWithHttpInfo(
zapTraceSpan: zapTraceSpan,
acceptEncoding: acceptEncoding,
contentType: contentType,
org: org,
orgID: orgID,
query: query);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'String',
);
}
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}