OData v4 (6.1.0) nested filter $ in $ expand

I have an asp.net 4.5 Web Api oData v4 service that works very well, but today I ran into the problem of nested $ filters in $ expand.

It says here

that OData V4 supports nested filters in $ expand. Request below the return People and all their trips named "Travel to the USA".

GET serviceRoot / People? $ expand = Trips ($ filter = Name eq 'Trip in US')

and it shows a good example of data that does just that.

There is also a coded example in the web API for oData v4 Docs here

I have an HTTP call:

serviceRoot/Languages?$expand=translations

      

which returns a list of languages ​​with their extended translations and I can filter the top level list with this:

serviceRoot/Languages?$expand=translations&$filter=isoLanguageShortName eq 'en'

      

However, I cannot filter the extended translations like this:

serviceRoot/Languages?$expand=translations($filter=languageName eq 'English')

      

This call seems to be the same as the one in the quote above and the effect should be the same as my data.

Does anyone know where I am going wrong? Do I need to set something in my ASP.NET code for this to work (for example, do we need to add MaxExpansionDepth to the EnableQueryAttribute to query deeper than two levels)?

+3


source to share


1 answer


This is a version issue. Support was added with version 5.5. I tested a sample with v5.5.1 and it actually works.

As @lukkea said it was using 5.4.0.



(Version 6.1.0 mentioned in the title corresponds to the odata core libraries which are dependencies of the odata apa library. Microsoft.AspNet.OData)

+1


source







All Articles