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.


You're updating the selected property on an employee resource.

So you can either:

PATCH /employees/:id with the correct value for selected if you support PATCH

or, if you don't want to support PATCH

PUT /employees/:id with the entire updated employee object.


If you want to bulk update then you are updating the collection. /employees - rather than a single resource.

Either PUT the entire collection with updated selected properties, which is a bit heavy handed,

Or PATCH the collection like so:

     "op": "replace",
     "path": "/1/selected",
     "value": true
     "op": "replace",
     "path": "/2/selected",
    "value": true
  • Thanks, but I want to support a bulk update. For example, the user moves items between the list and then saves changes, which triggers an HTTP request. Note, the total number of items in the lists can be in thousands. – user6946484 Jan 20 '18 at 6:27
  • Then you need to patch the collection. Updated the answer – JamesT Jan 20 '18 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.