If main application provides OData then we can use it anywhere in else application
The Open Data Protocol (OData) is a data access protocol for the web. OData provides a uniform way to query and manipulate data sets through CRUD operations (create, read, update, and delete).
Your MVC Action method should be like this
[Queryable(ResultLimit = 10)]
public IQueryable<service> Get()
{
return new Service[]
{
new Service { Id = 1, Description = "This is my service 1." },
new Service {Id = 2, Description = "This is my service 2."},
new Service {Id = 3, Description = "This is my service 3."}
}.AsQueryable();
}
Now you can request it like this ‘request to /api/service?$top=2’
And you will get json response like this
{ { "Id": "1", "Description": "This is my service 1."}, { "Id": "2", "Description": "This is my service 2."}}