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."}}}
2
  • Have you find a solution for this? I mean I need to do $expand=Properties($expand=ALookupColumn)
    – anbuj
    Jun 30, 2016 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, 2017 at 18:53

1 Answer 1

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
  • 1
    than you, @Vadim
    – egidiocs
    Mar 27, 2016 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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