rest - What should DELETE /collection do if some items can't be deleted? -


i have collection of items , of them may or may not deleted, depending on preconditions. if user wants delete resource (delete /collection/1) , there external dependencies on resource, server return error. should happen if user wants delete entire collection (delete /collection)?

should resources can deleted deleted , server return 2xx, or should server leave intact , return 4xx? expected behavior?

as rest api consumer, i'd expect operation atomic , maybe 409 conflict details if 1 of deletes fails. plus delete method theoretically idempotent @jbarrueta pointed out.

now if undeletable resources normal event in use case , happens frequently, may want stray norm little bit, delete can deleted , return 206 partial content (don't know if that's legal delete though) details undeleted resources.

however, if need manage error cases finely, might better off sending separate delete commands.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -