Overview

Filtering

The awork API supports a huge set of filters that can be executed on the majority of our API endpoints.

A filter can be applied by adding a filterby expression to the request URL:

1 /users?filterby=FirstName eq 'Sebastian'

Important: Special characters (like ?, & and =) within a string filter value need to be properly url encoded.

Correct: filterby=name eq 'awork %26 co' Incorrect: filterby=name eq 'awork & co'

If you want to filter by a nested property, you can do this by separating the Properties by /.

Logical Operations

You can invert the expression by using not before the statement

1 /users?filterby=not FirstName eq 'Sebastian'

Furthermore, you can combine expressions using the logical operator and

1/projects?filterby=PlannedDuration le 200 and PlannedDuration gt 3.5

as well as the logical operator or

1/projects?filterby=PlannedDuration le 200 or PlannedDuration gt 300

Precedence is defined with ( and ).

Data types

The data types DateTime and Guid have to be prefixed with the corresponding type identifier datetime and guid, respectively, e.g.

  • /users?filterby=birthDate ge datetime'2018-04-03T00:00'
  • /users?filterby=id eq guid'12345678-aaaa-bbbb-cccc-ddddeeeeffff'
TypeExample
Nullnull
Booleantrue|false
Byte0x22
DateTimedatetime’2000-12-12T12:00’
Decimal2.345M
Double2.029
Single2.0f
Guidguid’12345678-aaaa-bbbb-cccc-ddddeeeeffff’
Int32
Long64L
String’Hello awork’

Operators

OperatorDescriptionQuery
eqThe ‘eq’ operator filters and returns the items which matches the filter term./users?filterby=firstname eq 'Neil'
neThe ‘ne’ operator filters and returns the items which do not match the filter term./users?filterby=firstname ne 'Neil'
endswithThe ‘endswith’ operator filters and returns the items which end with the filter term./users?filterby=endswith(FirstName,'Neil')
startswithThe ‘startswith’ operator filters and returns the items which start with the string./users?filterby=startswith(FirstName,'Neil')
containsThe ‘contains’ operator filters and returns the items which contain the filter term./users?filterby=substringof('Neil',FirstName)
gtThe ‘gt’ operator filters and returns the items which are greater than the filter term./users?filterby=birthDate gt datetime'2018-04-03T00:00'
ltThe ‘lt’ operator filters and returns the items which are less than the filter term./users?filterby=birthDate lt datetime'2018-04-03T00:00'
leThe ‘le’ operator filters and returns the items which are less than or equal to the filter term./users?filterby=birthDate le datetime'2018-04-03T00:00'
geThe ‘ge’ operator filters and returns the items which are greater than or equal to the filter term./users?filterby=birthDate ge datetime'2018-04-03T00:00'
anyThe any operator iterates through the main entity (Project), executes the condition and returns the filtered list of projects where any member with a FirstName ‘Neil’ exists./projects?filterby=members/any(p: p/FirstName eq 'Neil')
countThe count operator iterates through the main entity (Project), and returns the filtered list of projects that have less than 10 members./projects?filterby=members/count() lt 10

Special Operator for the Current User

ExpressionDescription
eq me.idFilters for the current user

Special Operators for Date and Time

ExpressionDescription
lt nowFilters for less than current date-time
gt sowFilters for greater than start of week
gt eowFilters for greater than end of week
gt somFilters for greater than start of month
gt eomFilters for greater than end of month
eq todayFilters for today