Problem/Motivation
We want to support multiple operations during a single HTTP request. JSON API has no opinion (yet) on how to do that, but the JSON API community is thinking about releasing the Operations Extension
It's also worth noting that this extension will settle the transport format for messages in a future socket/stream based stack. See: https://github.com/json-api/json-api/issues/795#issuecomment-132734761
Proposed resolution
Implement the extension!
Comments
Comment #2
dawehnerInteresting to read!
Just from a software point of view we could clearly separate the HTTP level from the other retrieval of things.
Comment #3
e0ipsoAgreed. I thought a little bit about this, and I would even go further. I believe that there is no reason not to have a non-REST related module that is a generic web service.
That module would have a front controller. That front controller would semantically represent the entire content repository. Maybe
/transactions. That controller would only acceptPOSTorPATCHrequests with a payload. That payload would contain a set of sequential transactions (we could get in async stuff later) to execute.Every transaction will have all the information that an individual regular JSON API transaction should have encoded in that payload:
/api/node/articleread, add, update, replace, delete, explore{"filter": {"field_tags": {"value": "6"}}}With that information we can manually create the request object and have the
jsonapimodule do the processing and process the result.The response would be an array of JSON API document root responses, each one corresponding to the original transaction.
As you can see there is little that stops us from having a transactions socket instead of a
/transactionsHTTP endpoint. So thisjsonapi_transactionsmodule could not even be constraint by HTTP (although we may want to leave that for the future).Note that there is no intention to call this proposal REST. It is as RPC as it can be, but that is not a bad.
This proposal is heavily inspired (almost a direct import) of the ideas @dgeb is proposing in the JSON API discussion thread.
Comment #4
e0ipsoComment #5
wim leersRelated: #2350401: [PP-1] Collection denormalization. In particular, see comment #2350401-5: [PP-1] Collection denormalization. That points to https://tools.ietf.org/html/rfc6578#section-3.8, which is an enlightening read, and shows many of the problems.
Comment #6
wim leersVery very interesting! Both this issue, and https://github.com/json-api/json-api/issues/795. I left a comment there: https://github.com/json-api/json-api/issues/795#issuecomment-246751514.
I also wonder what the impact is of HTTP1 + REST vs HTTP2 + REST (multiplexing, streams).
Comment #7
e0ipsoIf anything this should happen in a separate contrib. Closing.