-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow POST requests #114
Comments
I'm appending here a sentence from the text removed in #21 that can be adapted and reused:
|
Should we add this to the 1.0 milestone? |
Are you really sure the POST is needed? Two observations on that:
|
While I'm not in favor of allowing POST per se (as @blokhin remarked, POST is reserved for database modifications), there are various restrictions on the length of GET request string. 2000 chars might seem a lot, but complex queries on nested property names easily approach it (to illustrate, a "simple" example from the specs is already 260 chars long). |
Is there a reference on that POST "modifies the content" / "is for database modifications"? Are you mixing up POST and PUT? The defining sentence of POST in RFC 7231 is "The POST method requests that the target resource process the representation enclosed in the request according to the resource's own specific semantics." It goes on to list examples, some of which modifies data, but the very first example is "Providing a block of data, such as the fields entered into an HTML form, to a data-handling process;" Isn't what we are doing more or less exactly providing a "block of data" (including, e.g., a massive filter) to a "data-handling process"? This is in difference to PUT, which says: "The PUT method requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload." In my opinion we should just say that the API implementation MUST support that any URL query parameter may instead be provided via POST. I don't see why it would be difficult to support in implementations, and it avoids arbitrary length limitations. |
I would be definitely against "MUST" since it puts extra (duplicate!) effort on implementer. Let's not succumb to creeping featurism! |
My understating of the REST is that POST is usually supposed to modify the resource |
@sauliusg Your point about POST vs GET was discussed upthread. The RFC you link lists example uses of POST and one of those examples is similar to ours. If we don't put MUST we can just as well not mention this in the specification. I don't see anything in the specification right now that prevents me from serving POST if I want to. The extra work to serve identically formed GET and POST requests is truly minimal in all web frameworks I've used. The only thing one needs to do is to stuff the POST fields into the same data structure that one put the GET url parameters in. Isn't it nice to have a standardized way to submit arbitrarily-length filter strings? |
Yes, this would be a very good feature. |
Yes, we should not put a MUST. Probably MAY. |
Sorry, I've overloked the reference but yes, its essentially the same how understand the situation. So in a few words:
|
My opinion: I'm supportive of allowing both POST and GET, and for now use the same syntax between the two, whatever the syntax is (so both for the client and the server, it's just a matter of deciding which method to use) |
If we decide to make POST support OPTIONAL, it becomes a feature a client cannot rely upon. I mean if I was to implement an "universal" OPTIMADE client (or anything skyscanner-like), I would not use POST as only a subset of providers support it. Instead, I would still use GET and would have to cater to its possible shortcomings. In short, I believe that all OPTIONAL convenience features are actually not that convenient. |
Could I ask which content type would be preferable for the POST request? usage example
|
With Support for other submission formats can of course be discussed, just as we have support for other custom response formats. In fact, I think it would be great to put in the specification that you are allowed to accept things like We need to register application/vnd.optimade, though. Perhaps we should do that? |
The following are widely used, and easily supported:
I don't see the need to do that. We can reuse already existing carrier formats, and I can't think of any feature in OPTIMADE that would push us to invent OPTIMADE-specific request format. |
Did you not understand my examples? How do you propose to handle provider-specific POST formats without risking collision with formats that we standardize at a later point? |
I would be in favour of |
As said, I can't think of any reason of inventing |
Let me try to spell out my example as clearly as possible. First, look at the similar situation with the Now, onto the case with submission formats. @fekad above suggests he wants to do POST with JSON-encoded data. Let's say he implements his own JSON representation of the OPTIMADE submission data and applies it to POSTs done as However, one is not allowed to just make up media formats, so he really should not use something like Does this make it more clear what use an |
Now the requests can only be GET.
In #21 we are removing the
/all
endpoint that was the only place mentioning POST requests.We should probably say that POST requests are allowed everywhere since query strings can become very long for non-trivial filters (also mentioning @rartino who I think is supportive)
The text was updated successfully, but these errors were encountered: