silkapp/rest

Create top-level multi-POST

hesselink opened this issue · 4 comments

We currently generate a multi-GET handler at the top level, that takes information on different requests in the body and returns multipart data. We should change this (or add something similar) to a POST, since bodies in GET requests are not supported in the browser, and are also against the spec, apparently. The POST endpoint could probably also take a verb key in the parameters, so that we can also support updates. The body could then be multipart containing all the inputs. Not sure if that's worth the extra complexity (also on sending) though.

@hesselink do you have an idea how much work this is to do?

Should be very easy, since we already have the multi-GET. Just changing it (or better yet, duplicating it, for backwards compat) to a POST would be super simple. Adding the verb (easy) and the multipart input (slightly harder) doesn't seem like that much work, but could run into unforeseen trickiness.

@jumi99 also mentioned that you lose caching for these requests if we change it to POST.

Another option is to keep it a GET and bundle the identifiers in the query string, which isn't pretty but easy to do on the client with jQuery, just set processData : false.

We talked about the caching yesterday, and indeed, we'd lose caching. Packing it in the query string seems very horrible: the body is not just urls, but also headers and parameters.