The Light
The Light

Reputation: 27011

How to Design a Restful API for a Bulk Save?

In my RESTful Web API application, I am using the below templates at the moment:

Get one product by id: 
GET api/product/12

Save product
POST api/product

Update product
PUT api/product

What is the best uri template for bulk post?

My inital thought is this:

POST api/product/bulk

Upvotes: 0

Views: 120

Answers (2)

Rayhan.iit.du
Rayhan.iit.du

Reputation: 279

[WebInvoke(Method = "POST",BodyStyle = WebMessageBodyStyle.Wrapped,
 ResponseFormat = WebMessageFormat.Json,
 RequestFormat = WebMessageFormat.Json)]

void SaveProduct(int productId);

suppose that, you have the following service with proper implementation. for this, your service uri will be :

yourDomain/SaveProduct/productId=productIdNumber

Upvotes: 3

Steven
Steven

Reputation: 172606

I find this more intuitive:

POST api/products

Upvotes: 2

Related Questions