I'm implementing a REST method that allows you to post a list of items. If all data is correct I obviously return a 201 and if all data is incorrect a 400.
What would be an appropriate response code if some items are correct and others are not?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communitySend a 400. Because the request is bad, even if part of it is good. It is bad because you can't act on what you've received.
If you are willing to step slightly outside pure HTTP responses, you could go the same way as the WebDAV protocol has done. They have extended the HTTP protocol with, among other things, a "multi-status response" (using code 207), that contains a status response for each individual item in its body.