Is an entity body allowed for an HTTP DELETE request?

后端 未结 15 1568
长发绾君心
长发绾君心 2020-11-21 13:32

When issuing an HTTP DELETE request, the request URI should completely identify the resource to delete. However, is it allowable to add extra meta-data as part of the entity

15条回答
  •  渐次进展
    2020-11-21 13:51

    Using DELETE with a Body is risky... I prefer this approach for List Operations over REST:

    Regular Operations

    GET /objects/ Gets all Objects

    GET /object/ID Gets an Object with specified ID

    POST /objects Adds a new Object

    PUT /object/ID Adds an Object with specified ID, Updates an Object

    DELETE /object/ID Deletes the object with specified ID

    All Custom actions are POST

    POST /objects/addList Adds a List or Array of Objects included in body

    POST /objects/deleteList Deletes a List of Objects included in body

    POST /objects/customQuery Creates a List based on custom query in body

    If a client doesn't support your extended operations they can work in the regular way.

提交回复
热议问题