postQueryWithHttpInfo method

Future<Response> postQueryWithHttpInfo({
  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.

Note: This method returns the HTTP Response.

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<Response> postQueryWithHttpInfo(
    {String? zapTraceSpan,
    String? acceptEncoding,
    String? contentType,
    String? org,
    String? orgID,
    required Query query}) async {
  final path = r'/query';

  Object postBody = query.toJson();

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (org != null) {
    queryParams.addAll(_convertParametersForCollectionFormat('', 'org', org));
  }
  if (orgID != null) {
    queryParams
        .addAll(_convertParametersForCollectionFormat('', 'orgID', orgID));
  }

  if (zapTraceSpan != null) {
    headerParams[r'Zap-Trace-Span'] = parameterToString(zapTraceSpan);
  }
  if (acceptEncoding != null) {
    headerParams[r'Accept-Encoding'] = parameterToString(acceptEncoding);
  }
  if (contentType != null) {
    headerParams[r'Content-Type'] = parameterToString(contentType);
  }

  final contentTypes = <String>['application/json', 'application/vnd.flux'];
  final nullableContentType =
      contentTypes.isNotEmpty ? contentTypes[0] : null;
  final authNames = <String>[
    'BasicAuthentication',
    'QuerystringAuthentication',
    'TokenAuthentication'
  ];

  return await apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    nullableContentType,
    authNames,
  );
}