Filter Rows
The $filter system query option states the condition the rows have to meet. The condition is passed on to the platform, so the rows which do not meet it are never retrieved.
A Single Comparison
GET .../odata4/ExactOnlineREST.Financial.GLAccountsBulk@eol?$filter=Division eq 920474
Text values are written between single quotes, and a quote inside the value is doubled:
GET .../odata4/ExactOnlineREST.Financial.GLAccountsBulk@eol?$filter=Code eq '0110'
Several Conditions
Conditions are combined with and and or, and brackets settle the order:
GET .../odata4/ExactOnlineREST.Financial.GLAccountsBulk@eol?$filter=Division eq 920474 and (Code eq '0110' or Code eq '0120')
A Set of Values
The in operator asks for a set of values on one column:
GET .../odata4/ExactOnlineREST.Financial.GLAccountsBulk@eol?$filter=Code in ('0110','0120','0130')
The same set written as a chain of alternatives, Code eq '0110' or Code eq '0120' or ..., is turned into this form as well, so both shapes reach the platform as one list. That matters on a platform which refuses a deeply nested condition, which several do beyond roughly fourteen alternatives.
The mirror image works too. Excluding values of one column with DivisionName ne 'ACME BV' and DivisionName ne 'ACME Holding BV' becomes a single exclusion list.
Part of a Text
Four functions look inside a text:
GET .../odata4/ExactOnlineREST.Financial.GLAccountsBulk@eol?$filter=startswith(Code,'01')
contains, startswith and endswith become a pattern comparison, in which the per cent sign stands for any number of characters and the underscore for exactly one. A searched value holding either of them therefore matches more than it appears to: contains(Code,'1_0') also finds 100 and 140.
What Cannot Be Filtered
The operators and functions which are read are listed in full in Supported OData 4 Features. Two limits are worth remembering while writing a filter:
not,mod,has,any,all,castandisofare not read;- a function which is not read is not always refused. The condition may be dropped from the query instead, and the answer then holds more rows than were asked for. So a filter is written with the four documented functions only.
Combining
A filter and a grouping do not sit side by side. Where rows have to be dropped before they are grouped, the condition moves inside the $apply; see Group and Aggregate Rows.