bobbyrne01 bobbyrne01 - 7 months ago 40
HTTP Question

Correct http status code to use if delete was only partially successful?

I have a

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
and any child documents.

If successful, respond with a status code of

If 2 out of 3 child documents fail to delete, for whatever reason, I'd like to include these in the
of response back to client.

What status code is most appropriate here? Considering some documents where deleted and others were not.


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.