Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Denormalize a collection is useful when posting a collection for updating multiple entities at once.
It depends on #2100637: REST views: add special handling for collections
Proposed resolution
Do it.
Comments
Comment #1
Wim Leers#2100637: REST views: add special handling for collections was moved to 8.1, so this should too.
Comment #2
Wim LeersComment #5
Grayside CreditAttribution: Grayside at Phase2 for Norwegian Cruise Line commentedIn practice, Collection Denormalization a.k.a. Batch Creation/Update is kind of a pain. I have heard more stories of people removing support after being happy to implement it than stories of people implementing it.
For those reasons, I think it makes more sense to build out in contrib and measure usage rather than support it in core.
Some of the complexities can be seen in RFC 6587 (WebDav) which scrolling down to section 3.8 shows you HTTP 207 Multi-Status as a clue for the kinds of hijinks you need to simulate support for clear, HTTP-centric communication about the batch results, and that's without the client-side.
Comment #6
Wim LeersWow, https://tools.ietf.org/html/rfc6578#section-3.8 is indeed frightening!
I still need to do some reading & research to better understand this feature and what it entails exactly. In my mind, this was just about being able to GET collections, not about being able to POST/PATCH/DELETE collections. Collection GET support is for sure the 90% use case.
Comment #7
Wim LeersSister issue for JSON API: #2760403: [FEATURE] Multiple operations in one request.
Comment #8
e0ipsoThat is very true. I think that a solution on this (provided there's technical viability) would be a good DX just as inline entity forms are a good admin experience.
I also agree with this. So, I'm unsure how much we need this.
I will keep the JSON API issue postponed until new arguments in favor are provided.
Comment #10
Wim LeersComment #16
Wim Leers2.5 years later, nothing has happened.
Since then, Drupal 8.7.0 has been shipping for 6 months with the JSON:API module which does support collections. It does not yet support bulk/batch creation. But that's being worked on for a future version of the JSON:API spec: https://github.com/json-api/json-api/issues/795.