[英]How to Design a Restful API for a Bulk Save?
在我的RESTful Web API應用程序中,我目前正在使用以下模板:
Get one product by id:
GET api/product/12
Save product
POST api/product
Update product
PUT api/product
批量發布的最佳uri模板是什么?
我的初始想法是這樣的:
POST api/product/bulk
[WebInvoke(Method = "POST",BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
void SaveProduct(int productId);
假設您具有正確實施的以下服務。 為此,您的服務uri將是:
YOURDOMAIN / SaveProduct /的productId = productIdNumber
我發現這更直觀:
POST api/products
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.