BAD
Create
POST http://path.to.backend/api/v1/follow/
{ target: string, }
Delete
DELETE http://path.to.backend/api/v1/follow/
{ target: string, }
GOOD
Create
PUT http://domain/api/v1/followings/<target>
Delete
DELETE http://domain/api/v1/followings/<target>
変更のお気持ちは?
- リソースの場所が確定しているか?
- リソースの場所が確定しているならURLに含める
- リソースの場所が確定していないならbodyに含める
例
新しい記事を投稿する場合
リソース(記事)のIDは確定していない
POST http://domain/api/v1/post
{ title: "hoge" body: "fugafuga" }
id=35の記事を削除する場合
リソース(記事)のIDは確定している!!
DELETE http://domain/api/v1/post/35