私は新しいREST APIエンドポイントを設計しており、APIのURLについて疑問を抱いています。RESTサービスリソースの名前付け
たとえば、私はProduct
エンティティと対応する/products
APIを持っています。
特定の製品を得るために、すべてが明確である - 私はのようなものを使用する必要があります:新しいものすべてを作成するために
GET /products/{productId}
をあまりにも明白である:
POST /products with a product details in the HTTP request body
どのように製品のアップデートに対処するのですか?
私は今見ることができる2つのオプションがあります:
PUT /products/{productId} with a new product details in the HTTP request body
または
PUT /products with a {productId} and new product details in the HTTP request body
は、製品の同じ質問を削除します。
{productId}
をサーバーに送信するためのベストプラクティスは何ですか。