I have written asp.net web-api project with following api-s:
Controller Method: Uri:
GetAllItems: /api/items (works)
GetItem(int id) /api/items/id (works) and
GetListOfItem(IEnumerable<Items> items) /api/items/List of items (doesn't work)
The function is similar to this (don't care about logic)
public IHttpActionResult GetByArray(IEnumerable<Book> bks)
{
var returnItems = items.Select(it => it).Where(it => it.Price < bks.ElementAt(0).Price || it.Price < bks.ElementAt(1).Price);
if (returnItems == null)
return NotFound();
else
{
return Ok(returnItems);
}
}
I am using postman to send requests and following requests works correct
http://localhost:50336/api/items/
http://localhost:50336/api/items/100
but not
http://localhost:50336/api/items/[{"Owner":"MySelf","Name":"C","Price":151},{"Owner":"Another","Name":"C++","Price":151}]
How should i format the last request where i have a list of items in json format in order to get it works?