Filtering support
The $filter system query option allows clients to filter a collection of resources that are addressed by a request URL. The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response.
The following filter keywords are supported:
- Logical operators: eq, ne, gt, ge, lt, le, and, or, not
- Arithmetic operators: add, sub, -, mul, div, mod
- Grouping operator: ( )
- String functions: concat, contains, endswith, indexof, length, startswith, substring, tolower, toupper, trim
- Date and Time functions: date, day, fractionalseconds, hour, maxdatetime, mindatetime, minute, month, now, second, time, totaloffsetminutes, totalseconds, year
- Arithmetic functions: ceiling, floor, round
Name | Keyword | Description |
---|---|---|
Equals | eq | The eq operator returns true if the left operand is equal to
the right operand, otherwise it returns
false. Examples:
|
Not Equals | ne | The ne operator returns true if the left operand is not equal
to the right operand, otherwise it returns
false. Examples:
|
Greater Than | gt | The gt operator returns true if the left operand is greater than the right operand, otherwise it returns false. |
Greater Than or Equal | ge | The ge operator returns true if the left operand is greater than or equal to the right operand, otherwise it returns false. |
Less Than | lt | The lt operator returns true if the left operand is less than the right operand, otherwise it returns false. |
Less Than or Equal | le | The le operator returns true if the left operand is less than or equal to the right operand, otherwise it returns false. |
And | and | The and operator returns true if both the left and right
operands evaluate to true, otherwise it returns
false. Example:
|
Or | or | The or operator returns false if both the left and right
operands both evaluate to false, otherwise it returns
true. Example:
|
Not | not | The not operator returns true if the operand returns false,
otherwise it returns
false. Example:
|
Name | Keyword | Description |
---|---|---|
Addition | add | The add operator adds the left and right numeric
operands. Examples:
|
Subtraction | sub | The sub operator subtracts the right numeric operand from the
left numeric
operand. Examples:
|
Negation | - | The negation operator, represented by a minus (-) sign,
changes the sign of its numeric or Duration
operand. Example:
|
Multiplication | mul | The mul operator multiplies the left and right numeric
operands. Examples:
|
Division | div | The div operator divides the left numeric operand by the right
numeric
operand. Examples:
|
Modulo | mod | The mod operator returns the remainder when the left integral
operand is divided by the right integral
operand. Examples:
|
Name | Keyword | Description |
---|---|---|
Grouping operator | ( ) | The Grouping operator (open and close parenthesis “( )”)
controls the evaluation order of an expression. The Grouping operator returns the expression grouped
inside the
parenthesis. Examples:
|
Name | Keyword | Description |
---|---|---|
Concatenate | concat | The concat function returns a string that appends the second
input parameter string value to the
first. Examples:
|
Contains | contains | The contains function returns true if the second parameter
string value is a substring of the first parameter string value, otherwise it returns
false. Example:
|
Ends with | endswith | The endswith function returns true if the first parameter
string value ends with the second parameter string value, otherwise it returns
false. Examples:
|
Index of | indexof | The indexof function returns the zero-based character position
of the first occurrence of the second parameter value in the first parameter value, or -1 if the
second parameter value does not occur in the first parameter
value. Examples:
|
Length | length | The length function returns the number of characters in the
parameter
value. Examples:
|
Starts with | startswith | The startswith function returns true if the first parameter
string value starts with the second parameter string value, otherwise it returns
false. Examples:
|
Substring | substring | The two argument substring function returns a substring of the
first parameter string value, starting at the Nth character and finishing at the last character
(where N is the second parameter integer value). The three argument substring function returns a
substring of the first parameter string value identified by selecting M characters starting at the
Nth character (where N is the second parameter integer value and M is the third parameter integer
value). Examples:
|
To lower | tolower | The tolower function returns the input parameter string value
with all uppercase characters converted to lowercase according to Unicode
rules. Example:
|
To upper | toupper | The toupper function returns the input parameter string value
with all lowercase characters converted to uppercase according to Unicode
rules. Example:
|
Trim | trim | The trim function returns the input parameter string value
with all leading and trailing whitespace characters, according to Unicode rules,
removed. Example:
|
Name | Keyword | Description |
---|---|---|
Date | date | The date function returns the date part of the DateTimeOffset
parameter value, evaluated in the time zone of the DateTimeOffset parameter
value. Example:
|
Day | day | The day function returns the day component Date or
DateTimeOffset parameter value, evaluated in the time zone of the DateTimeOffset parameter
value. Examples:
|
Fractional seconds | fractionalseconds | The fractionalseconds function returns the fractional seconds
component of the DateTimeOffset or TimeOfDay parameter value as a non-negative decimal value less
than
1. Examples:
|
Hour | hour | The hour function returns the hour component of the
DateTimeOffset or TimeOfDay parameter value, evaluated in the time zone of the DateTimeOffset
parameter
value. Examples:
|
Maximum datetime | maxdatetime | The maxdatetime function returns the latest possible point in
time as a DateTimeOffset
value. Example:
|
Minimum datetime | mindatetime | The mindatetime function returns the earliest possible point
in time as a DateTimeOffset
value. Example:
|
Minute | minute | The minute function returns the minute component of the
DateTimeOffset or TimeOfDay parameter value, evaluated in the time zone of the DateTimeOffset
parameter
value. Examples:
|
Month | month | The month function returns the month component of the Date or
DateTimeOffset parameter value, evaluated in the time zone of the DateTimeOffset parameter
value. Examples:
|
Now | now | The now function returns the current point in time (date and
time with time zone) as a DateTimeOffset
value. Example:
|
Second | second | The second function returns the second component (without the
fractional part) of the DateTimeOffset or TimeOfDay parameter
value. Examples:
|
Time | time | The time function returns the time part of the DateTimeOffset
parameter value, evaluated in the time zone of the DateTimeOffset parameter
value. Example:
|
Total offset minutes | totaloffsetminutes | The totaloffsetminutes function returns the signed number of
minutes in the time zone offset part of the DateTimeOffset parameter value, evaluated in the time
zone of the DateTimeOffset parameter
value. Example:
|
Total seconds | totalseconds | The totalseconds function returns the duration of the value in
total seconds, including fractional
seconds. Example:
|
Year | year | The year function returns the year component of the Date or
DateTimeOffset parameter value, evaluated in the time zone of the DateTimeOffset parameter
value. Examples:
|
Name | Keyword | Description |
---|---|---|
Ceiling | ceiling | The ceiling function rounds the input numeric parameter up to
the nearest numeric value with no decimal component.
Examples:
|
Floor | floor | The floor function rounds the input numeric parameter down to
the nearest numeric value with no decimal
component. Examples:
|
Round | round | The round function rounds the input numeric parameter to the
nearest numeric value with no decimal component. The mid-point between two integers is rounded away
from zero, i.e. 0.5 is rounded to 1 and -0.5 is rounded to
-1. Examples:
|