postQueryWithHttpInfo 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.
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
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<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,
);
}