postQuery method

Future<String> postQuery({
  1. String? zapTraceSpan,
  2. String? acceptEncoding,
  3. String? contentType,
  4. String? org,
  5. String? orgID,
  6. required Query query,
})

Query data

Retrieves data from InfluxDB buckets. To query data, you need the following: - organizationSee View organizations for instructions on viewing your organization ID. - API tokenSee View tokens for instructions on viewing your API token. - InfluxDB URLSee 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 and org are specified, org takes precedence.

  • String orgID: Specifies the ID of the organization executing the query. If both orgID and org 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));
}