Paul C
Paul C

Reputation: 4766

Does OData 2.0 support "contains" in the filter

I can see in the Basic Tutorial section of the odata website that you can perfom a contains search using a filter

GET serviceRoot/Airports?$filter=contains(Location/Address, 'San Francisco')

The API I am using refused this when I tried to use it. The API I am accessing is OData 2.0.

So I wanted to know if OData 2.0 supports the contains filter but couldn't find a list anywhere documenting the filters you could use e.g. startsWith, endsWith, contains

Upvotes: 0

Views: 7606

Answers (1)

Paul C
Paul C

Reputation: 4766

My research led me to the only answer I could find which was to use substringof instead of contains. This is the end of the url call from the actual API I am working on. This results in searching for Items filtered by Description containing "69":

/logistics/Items?$filter=substringof('69',%20Description)%20eq%20true

Upvotes: 2

Related Questions