API request with BODY does not supported
wizcabbit opened this issue · comments
The API "List Filtered Rows" is "GET" request but needs JSON body to define filter content.
Is this a standard method for HTTP? I am sure not all web library could send a "GET" request with body (maybe can do in python requests)
HTTP support GET with BODY. curl can work with it. Though not all libraries support such kind of usage.
That means we are ignoring the recommendation in the HTTP/1.1 spec, section 4.3.
This RESTful API can not be used in many languages such as Java, C# etc...
The RFC2616 you referenced as "HTTP/1.1 spec" is now obsolete. In 2014 it was replaced by RFCs 7230-7237.
Both the GET request is a standard method in HTTP and a standard HTTP request can have a request body.
As you've mentioned, the "List Filtered Rows" API request is making use of both (filter parameters can easily exceed standard request URI lengths and therefore the request body is used).
If you want to tinker with it on the command-line, curl (1)
supports GET + body, many languages have a binding to the curl
library.
Which library are you using or are you planning to use to send the request?
Though not all libraries support such kind of usage.
As a concession the API could allow the POST method on that endpoint (next to GET). It would defeat caching, implementations can continue to use GET for that though. @freeplant
Normally I use RestSharp in C# and HttpClient in Java, both can not add body to GET request, then I replace RestSharp with HttpClient in .NET Framework, nether allowed to send body with GET request.
My code is for an internal class library, I am not sure if the environment has curl / wget or other command-line, and it's weird to call an external command-line
My code is for an internal class library, I am not sure if the environment has curl / wget or other command-line, and it's weird to call an external command-line
Next to curl(1)
on the command-line there is also curl as libcurl(3)
which has bindings to different languages which does not depend on userspace binaries. YMMV.
In general I'm not using .NET myself in this context, most likely others can give better suggestions, maybe https://stackoverflow.com/a/59530827/367456 shows more options.
Thanks a lot, that helps.