My route, POST /items
, saves items, which show up in the payload.
The client would like items to save even if others do not.
Example:
POST /items
with a body of [1,2]
.
1
saves, but 2
does not due to a client-side error.
In this event, it seems worthwhile to return an HTTP-400
since 2
is invalid due a client error, i.e. invalid item ID.
Example 2:
POST /items
with a body of [1,2]
.
1
saves, but 2
does not due to a server-side error.
In this event, it seems worthwhile to return an HTTP-500
since 2
is invalid due a client error, i.e. invalid item ID.
Example 3:
POST /items
with a body of [1,2,3]
.
1
saves, but 2
does not due to a server-side error. 3
fails to save due to a client-side error.
What's the appropriate response here? Does the existence of a server-side error trump the client-side error, i.e. HTTP-500
is appropriate?
In all cases, the response payload would include successes and failures.
Do these HTTP response codes make sense? If not, what's the REST-ful alternative?