This example adds an edit form to a tag collection with different mime-types (eg uri-list and application/json-patch+json) for use to update a the resources on a collection. This example updates a tags collection. Navigate to this resource from the home via the ‘me’ > ‘todos’ > pick a todo list > ‘todos’ > pick a todo > ‘tags’.

edit-form link relationuri-list for PUT (make the collection ‘so’)application/json-patch+json for PATCH (make collection based on a series of change sets)Note: both are constrained versions of adding/removing tags (items) from the collection and not updating the tag resources themselves
Note: editing a collection can also be performed by adding items (ie create-form) and/or removing via following the item link and then deleting.
| Method | link rel | associated route | notes |
|---|---|---|---|
| GET | /todo/{id}/tag | add
edit-form
as a link rel for each of the media types |
|
| PUT | /todo/{id}/tag | send a
text/uri-list |
|
| PATCH | /todo/{id}/tag | send as a
json-patch+json document |
Note: by convention a form can be submitted semantically. Here, because the ‘edit-form’ has a type, you submit back onto the originating resource’s ‘self’ link. Note: this design requires the client to know that an ‘edit-form’ type of
text/uri-listis a PUT and that anapplication/json-path+jsonis a PATCH operation. Furthermore, while each does have an edit form describing their contents, this redundant because these are known media types that the client already knows how to construct.Important: both are batching strategies that have their place.
Below, you see on overview of the code, then you see the implementation.
Below, you see on overview of the code, then you see the implementation.