Is it okay to use an HTTP DELETE to deactivate a record?

后端 未结 3 776
夕颜
夕颜 2021-02-19 05:48

I\'m building a RESTful API command to deactivate a user record. Is it kosher to use DELETE to do this or should this be a PUT, since the record is being updated to \"deactivate

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-19 06:34

    If after your deactivation operation, the resource is not accessible to the end user any more through "GET" unless it is reactivated again, I do not see a problem using "DELETE". Otherwise, "PUT" is more appropriate.

提交回复
热议问题