これは REST URL の適切な構造ですか?
仮定:
GET /account <- get list of accounts
GET /account/1234 <- get account 1234
等
アカウント リソースにインターフェースしたいコレクションがある場合、これは良い考えですか?
GET /account/1234/note <- get notes for account 1234
POST /account/1234/note <- add note to account 1234
DELETE /account/1234/note/321 <- delete note 321 on account 1234
特に最後のものは私を一時停止させます。通常、削除するときにエンティティ ID と親 ID の両方は必要ありません。
それとも、このようなものが良いでしょうか?
GET /account-note/1234 <- get notes for account 1234
POST /account-note/1234 <- add note to account 1234
DELETE /account-note/321 <- delete note 321 on account 1234 (b/c note 321 is on account 1234)
しかし、その後、非常に浅い URL セットになってしまいます。
ありがとう