What should DELETE / collection do if some items cannot be deleted?

I have a set of elements, and some of them may or may not be deleted, depending on some preconditions. If the user wants to delete the resource ( DELETE /collection/1) and there are external dependencies on this resource, the server will return an error. But what should happen if the user wants to delete the entire collection ( DELETE /collection)?

If all resources that can be deleted are deleted and the server returns 2xx, or should the server leave everything unchanged and return 4xx? What will be the expected behavior?

+4
source share
3 answers

REST API, , , , 409 Conflict , . , DELETE , @jbarrueta.

, , , , , - 206 Partial Content ( DELETE, ) .

, , DELETE.

+3

, - 409 - - ( ). .

, REST SOAP/RPC, . REST , HATEOAS, .

  • , DELETE /collection, , , . , - , , .

  • , "" , .

, , () , , GET.

  1. ( ), .
  2. , PATCH , , .
+1

, ( DELETE /collection/all DELETE/collection/),

, delete , , , , , , - , , , . .

,

  • -
  • -

, DELETE URL-,

- DELETE /collection/unused

ALL - DELETE /collection/all

0

All Articles