Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query option 'Format' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings

I'm getting an exception on my Web API controller endpoint and I would appreciate some help solving it.

Here is the story:

In my Web API project, a controller exposes the following endpoints:

enter image description here

My Kendo UI Datagrid makes the following request:

http://localhost:63865/api/employees/GetAll?$callback=jQuery21109420544053427875_1410883352953&%24inlinecount=allpages&%24format=json&%24top=5

I'm getting this exception when validating the ODataQueryOptions sent in the request:

Query option 'Format' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.

enter image description here

But I've enabled all query options:

[EnableQuery(AllowedQueryOptions=AllowedQueryOptions.All)]

What am I doing wrong ?

like image 715
EdsonF Avatar asked Oct 22 '25 22:10

EdsonF


1 Answers

Finally manage to get to the bottom of this!

After creating the ODataValidationSettings object I needed to change the AllowedQueryOptions to AllowedQueryOptions.All. Be default all options are there except the Format and SkipToken.

enter image description here

Anyway, hope this may help anyone else facing the same issue.

like image 200
EdsonF Avatar answered Oct 24 '25 17:10

EdsonF