Since RestBundle supports convention for "collection" of resources, it's logical to add some convention for bulk manipulations with resources in collection.
I see three features here:
- Create multiple resources with one request (e.g. via import/export tools)
- Update multiple resources with one request
- Delete several resources with one request
RestBundle already supports GET for collection, which is supposed to return list of resources in collection.
POST is also supported, but right now it is supposed to create single new resource. I think it's worth mentioning that you can also POST several resources to add all of them to collection.
In theory, PUT to collection should overwrite it completely: e.g. delete all resources in collection and recreate PUTed resources.
Partial collection update is harder, but I believe PATCH method is well suited for this: you can send a set of PATCHes inside request body, which will be mapped and applied to related collection resources.
Bulk delete should be also done as a part of PATCH request to collection, since it partially modifies the collection.
I think bundle already supports most of required features for this, except PATCH method (ticket #50).
This ticket is just for collaboration on the topic, since bulk actions are ofthen done wrong or differently in different implementations, so it probably worth to come with some best practices here.
Also, the collection of resources is pretty generic use-case, so one day we may even want to create custom media-type for such conventional collection, e.g. application/x-collection+json; application/x-collection+xml, etc.
What do you think?