Skip to content

Commit 894dde0

Browse files
committed
Successfully query influx
1 parent c6b5f1f commit 894dde0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

influxdb.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,15 @@ namespace influxdb_cpp {
8181
};
8282
}
8383

84-
inline int query(std::string& resp, const std::string& query, const server_info& si) {
85-
std::string qs("&q=");
86-
detail::inner::url_encode(qs, query);
87-
return detail::inner::http_request("GET", "query", qs, "", si, &resp);
84+
inline int flux_query(std::string& resp, const std::string& query, const server_info& si) {
85+
86+
// query JSON body
87+
std::stringstream body;
88+
body << "{\"query\": \"";
89+
body << query;
90+
body << "\", \"type\": \"flux\" }";
91+
92+
return detail::inner::http_request("POST", "query", "", body.str(), si, &resp);
8893
}
8994

9095
struct builder {

0 commit comments

Comments
 (0)