eTask REST interface uses OData’s expression to provide filters in many of its query. eTask REST API supports the following OData operators:
Name | Description | Example |
---|---|---|
$count | Retrieves the total count of matching resources. | /api/tasks?$top=20&$count=true |
$filter | Filters results (rows). | /api/tasks?$filter=(status eq ‘Not Started’) |
$select | Filters properties (columns). | /api/tasks?$select=name,priority&$top=10 |
$orderby | Orders results. | /api/tasks?$orderby=internalId desc |
$skip | Indexes into a result set. Also used by some APIs to implement paging and can be used together with $top to manually page results. | /api/tasks?$skip=11 |
$top | Sets the page size of results. | /api/tasks?$top=20&$count=true |
eTask REST Endpoint currently support the following OData filter expressions:
Name | Examples |
---|---|
Equal | $filter=(status eq ‘Not Started’) Query on list of tasks. Return tasks that have status field is Not Started |
Less than | $filter=(startDate lt ‘$date:2020-09-17T16:59:59Z’) Query on list of tasks. Return tasks that have startDate less than 2020-09-17T16:59:59Z |
Greater than | $filter=(startDate gt ‘$date:2020-09-17T16:59:59Z’) Query on list of tasks. Return tasks that have startDate greater than ‘2020-09-17T16:59:59Z’ |
Greater than or equal to | $filter=(internalId ge 5) Query on list of tasks. Return tasks that have internalId greater than or equal to 5 |
Less than or equal to | $filter=(internalId le 5) Query on list of tasks. Return tasks that have internalId less than or equal to 5 |
Select a range of values | $filter=(createdAt ge ‘$date:2020-09-01T17:00:00Z’ and createdAt le ‘$date:2020-09-09T16:59:59Z’) Query on list of tasks. Return tasks that have createdAt greater than or equal to 2020-09-01T17:00:00Z and less than or equal to 2020-09-09T16:59:59Z |
And | $filter=(priority eq ‘High’) and (status eq ‘Not Started’) Query on list of tasks. Return tasks that have status is ‘Not Started’ and priority is ‘High’ |
Or | $filter=(status eq ‘Not Started’ or status eq ‘In Progress’) Query on list of tasks. Return tasks that have status is ‘Not Started’ or ‘In Progress’. |
substringof | $filter =(substringof(‘API’, name)) Query on list of tasks. Return tasks records that have name with names containing the string ‘API’. |
Notes:
datetime
for example datetime’2016-04-25T05:16:43.1354695Z’.Additional reference on OData expression are here: https://docs.microsoft.com/en-us/dynamics-nav/using-filter-expressions-in-odata-uris.
Comment