I'm working on a backbone.js app that GET the odata format from the controller:
public IQueryable<ContactList> Get()
{
return dbContext.ContactsList.AsQueryable();
}
But the way I receive the data is in the following format
odata.count: "15504"
odata.metadata: "http://localhost:53341/odata/$metadata#Prescribers"
odata.nextLink: "http://localhost:53341/odata/Prescribers?$inlinecount=allpages&$format=application%2Fjson%3Bodata%3Dverbose
value: [,…]
Note the $format. Despite setting this up, it keeps sending me data in odata v3 format. I also tested it in Fiddler, but still the same result.
Am I doing something wrong? I'm trying to use the data for Backbone paginator https://github.com/backbone-paginator/backbone.paginator
I don't think webapi.odata v3 supports $format.
But you can try setting the accept header with
application/json;...
If you want to use
$format
in the url, you can call "AddQueryStringMapping" to map$format
, check this:http://www.c-sharpcorner.com/UploadFile/2b481f/odata-feed-using-Asp-Net-web-api/