I'm trying to figure out what my API route and HTTP method should be for supporting a dual list box (e.g. http://geodan.github.io/duallistbox/sample-100.html)
Say, I have a collection, GET /employees
which looks like:
[
{'id': 1, 'name': 'Foo', 'selected': true},
{'id': 2, 'name': 'Bar', 'selected': false}
]
where Foo
would be in the list on the right and Bar
would be on the left.
If the action of moving the items from left to right (or vice-versa) in the dual list box only changes the value of 'selected', should I be using:
- JSON PATCH (items that moved) to
/employees
- POST (items in the right list) to
/employees/selected
(GET /employees/selected doesn't exist) - PATCH (items in the right list) to
/employees/selected
- Some other method and route?
Edit: Note, I'm interested in bulk updates use case. Don't want to trigger an HTTP request after every user action.