2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

論理削除するAPIのHTTPメソッドは何を使うべきか

Last updated at Posted at 2022-12-15

RESTの思想ではリソースの削除はDELETEメソッドですが、論理削除の場合はどうなんでしょう。

  • フラグ等の更新で削除自体はしていないから、PATCH?
  • 意図は「削除」だからDELETE?

結論

正解は無いものの、調べる限りDELETE推しが多い印象。

  • APIを使用する側からしたら、削除の意図で使用する
  • 物理削除か論理削除かはアプリケーション内部の仕様であり、使用する側には関心のないこと

とはいえ、どのメソッドを使うかよりもアプリケーション内で基準が一貫していることの方がずっと大事ですね。

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?