Bunun gibi daha geleneksel bir düzen yerine, merak ediyorum:
api/Products
GET // gets product(s) by id
PUT // updates product(s) by id
DELETE // deletes (product(s) by id
POST // creates product(s)
Tekil ve çoğul olmak daha yararlı olur mu, örneğin:
api/Product
GET // gets a product by id
PUT // updates a product by id
DELETE // deletes a product by id
POST // creates a product
api/Products
GET // gets a collection of products by id
PUT // updates a collection of products by id
DELETE // deletes a collection of products (not the products themselves)
POST // creates a collection of products based on filter parameters passed
Yani, yapabileceğiniz bir ürün koleksiyonu oluşturmak için:
POST api/Products {data: filters} // returns api/Products/<id>
Ve sonra, referans vermek için şunları yapabilirsiniz:
GET api/Products/<id> // returns array of products
Kanımca, işleri bu şekilde yapmanın ana avantajı, ürün koleksiyonlarının kolayca önbelleğe alınmasına izin vermesidir. Örneğin, ürün koleksiyonlarına bir saatlik bir ömür verilebilir, böylece bir sunucudaki çağrılar büyük ölçüde azalır. Tabii ki, şu anda işleri bu şekilde yapmanın sadece iyi tarafını görüyorum, olumsuz tarafı nedir?