5

Can anyone tell what is odata version used by SharePoint REST Api?

I am asking because I tried to run the Nested Filter in Expand supported by OData V4. http://www.odata.org/getting-started/basic-tutorial/ :

OData V4 supports nested filters in $expand. The request below return People and all their trips with Name "Trip in US". GET serviceRoot/People?$expand=Trips($filter=Name eq 'Trip in US')

Then I tried to

/_api/Web/Lists/GetByTitle('Conglomerates')/items?&$select=Id,Title,Company/Title,Company/Id&$filter=Company eq 18&$expand=Company($filter=Id eq 18)

and got

{"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression \"Empresa($filter=Id eq 18)\" is not valid."}}}
  • Have you find a solution for this? I mean I need to do $expand=Properties($expand=ALookupColumn) – anbuj Jun 30 '16 at 7:01
  • As a side note: the presented query can be rewritten as _api/Web/Lists/GetByTitle('Conglomerates')/items?$expand=Company&$select=Id,Title,Company/Title&$filter=Company/Id eq 18 (assuming 18 is the value of some field in the Company list - I used 'ID' but it could be another one). If you want to filter the "main" list in your query using a field in the lookup list there's no need to do Nested Filters. They are useful when you want to filter the associated items in the lookup list, as the example quoted from OData tutorial - return People and *all their trips with Name "Trip in US"* – GBU Apr 11 '17 at 18:53
11

Unfortunately SharePoint REST API does not support OData V4 at the moment. You could determine the current version of OData version by executing metadata query:

Url: https://server/_api/$metadata
Method: Get

The specified query returns against SharePoint Online DataServices m:DataServiceVersion="3.0" which corresponds to OData V3

  • 1
    than you, @Vadim – egidiocs Mar 27 '16 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.