MikaelGRA / InfluxDB.Client

InfluxDB Client for .NET
MIT License
102 stars 22 forks source link

Support POST for querying data #17

Closed mkontula closed 6 years ago

mkontula commented 7 years ago

InfluxDB also supports POST for querying values. This is relevant when query's url presentation tends to get lengthy and it throws tiz-url-is-too-laaaang-exception.

This would be quite small modification to InfluxClient, but before making a PR, I was wondering how @MikaelGRA you would like this to be implemented. Should I introduce an overload for ReadAsync which would take the desired HttpMethod as parameter? If done this way, it would remain 100% backwards compatible. Another alternative would be ReadPostAsync but it looks kinda funky to me as a name.

MikaelGRA commented 6 years ago

I think simply adding an extra property to InfluxQueryOptions would be appropriate.

Could simply be an an enum with the http method. This would also maintain complete backwards compatibility with previous versions.

MikaelGRA commented 6 years ago

I see you made a pull request, but I will probably just implement this myself, since I cannot see how you are handling the construction of the form url encoded content which is required.

Might steal your test though. ;)

MikaelGRA commented 6 years ago

Did check in an untested version for now. Will probably continue the work tomorrow.

Might have to do a bit of restructuring if I want the query options to be applied to all types of queries though (such as commands to show fields or even just delete statements). So I might take a look at that as well, although I am not entirely sure.

mkontula commented 6 years ago

application/x-form-url-encoded is basicly query string formatted body in post. It's as simple as that. So by constructing the url with existing helpers and sending it via post it's done deal. I was thinking about the enum for http method, but since it can only be get/post I opted for bool. Thought about InfluxQueryOptions as well. In my tests the taken approach worked just fine, but any implementation will do.

MikaelGRA commented 6 years ago

OK. I implemented it. Will upload it momentarily.

I have implemented it in such a way that all operations that uses the "query" endpoint can now use the POST operation if specified in the InfluxQueryOptions.

mkontula commented 6 years ago

Kudos, Sir. Keep in touch as our project will be implementing more and more new feature req's. Nice job!