Reputation: 6745
I have a REST
API
that allows users to delete documents in a nosql database. Any child documents will also be removed. ..
DELETE /api/document/dummyId
So this would delete document with id
of dummyId
and any child documents.
If successful, respond with a status code of 204
.
If 2 out of 3 child documents fail to delete, for whatever reason, I'd like to include these in the body
of response back to client.
What status code is most appropriate here? Considering some documents where deleted and others were not.
Upvotes: 2
Views: 797
Reputation: 99533
There is no correct HTTP status code for this, because the DELETE
statement MUST either fully succeed or not do anything at all.
There's not really a "partial success" in HTTP. WebDAV does add this to some features, but even in WebDAV the DELETE
must fully succeed or not affect the state of the resource.
Upvotes: 3