Planning to use http status 207/ multi status as a response for updating/deleting list of objects in a REST api. I plan to respond with 204 if all succeeds and 207 if it's a mixture of successes/failures.
Is this the right usage for 207?
What scenarios does http 207 commonly used on?
The 207 HTTP status code means that the request is a multi-status response that includes information on a variety of resources. It is followed by an XML message containing individual response codes.
The 204 (No Content) status code indicates that the server has successfully fulfilled the request and that there is no additional content to send in the response payload body. While 200 OK being a valid and the most common answer, returning a 204 No Content could make sense as there is absolutely nothing to return.
2xx Status Codes [Success] Indicates that the request has succeeded. Indicates that the request has succeeded and a new resource has been created as a result. Indicates that the request has been received but not completed yet.
If you perform a destructive operation like POST, PUT, DELETE against more than one resource and the operations against each individual resource did not share a common outcome then you can go for 207.
For example,
Some more discussion on 207 status.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With