Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to use oData query options

I have an ASP.NET Web API project. I'm trying to pass some query options to my API controller like so:

http://localhost:61736/api/Enquiries?
callback=callback&$top=30&$skip=30&orderby=EnquiryId
&$inlinecount=allpages&_=1346164698393

But I get the following:

The query parameter '$inlinecount' is not supported.

I also get the same when I try to use $callback, $format

Any idea what I'm doing wrong? According to: http://msdn.microsoft.com/en-us/library/ff478141.aspx I should be able to use them?

like image 374
CallumVass Avatar asked Aug 28 '12 14:08

CallumVass


People also ask

How do I enable OData query globally?

The EnableQuerySupport method enables query options globally for any controller action that returns an IQueryable type. If you don't want query options enabled for the entire application, you can enable them for specific controller actions by adding the [Queryable] attribute to the action method.

What are OData query options?

A query option is a set of query string parameters applied to a resource that can help control the amount of data being returned for the resource in the URL.


1 Answers

The ASP.NET Web API provides only limited support for OData as documented in this blog post. I didn't see the query parameters you mention in that list.

like image 180
Sixto Saez Avatar answered Sep 25 '22 01:09

Sixto Saez