REST API: Complex directory filters
From Planfix
Complex filters in REST API Planfix are used in the "/directory/{id}/entry/list" method to obtain directory entries. Directory filters are specified with the following parameters:
- type — numeric identifier of the filter.
- operator — filter operator, one of the values from the list (equal, notequal, gt, lt). Different filters can have different allowed operators.
- value — filter value, which can be a string, a number, or a complex object, depending on the filter type.
- field — Identifier of the directory's custom field of the directory after which the filter is performed.
Example of a request to obtain a list of directory entries with several filters by a custom field of type "Date" and a custom field of type "Employee List" (AND logic is used):
{ "offset": 0, "pageSize": 100, "fields": "directory,parentKey,key,3,5", "filters": [ { "type": 6103, "field": 3, "operator": "equal", "value": { "dateType": "otherRange", "dateFrom": "15-12-2022", "dateTo": "17-12-2022" } }, { "type": 6109, "field": 5, "operator": "equal", "value": "user:50" } ] }
Type | Name | Operators | Format value |
---|---|---|---|
6103 | Directory field type "Data" |
|
Object :
"value": { "dateType": string, "dateValue": string, "dateFrom": string, "dateTo": string }
Whether a date is considered in the past depends on the time zone of the employee who made the request. Examples: "value": { "dateType": "thisWeek" } "value": { "dateType": "otherRange", "dateFrom": "01-12-2022", "dateTo": "06-12-2022" } "value": { "dateType": "otherDate_withTime", "dateFrom": "30-12-2022 12:00", } |
6108 | Directory field type "Contact" |
|
string - employee/contact/group number with a prefix.
For example: “user:1”, “contact:5”, “group:3” |
6109 | Directory field type "Employee" | ||
6110 | Directory field type "Counterparty" | ||
6112 | Directory field type "Group, employee, contact" | ||
6113 | Directory field type "Employee list" |
|
string - contains/does not contain filter is applied |
6101 | Directory field type "Employee list" |
|
string - equal/not equal/ contains/does not contain filter is applied |
6102 | Directory field type "Number" |
|
int |
6105 | Directory field type "Checkbox" |
|
int - 1/0 boolean |
6005 | Is the entry archived | ||
6106 | Directory field type "List" |
|
string |
6107 | Directory field type "Directory entry" |
|
int - entry identifier |
6114 | Directory field type "Set of directory entries" |
|
int — entry identifier, for condition by several entries — identifiers through; (semicolon) |
6115 | Directory field type "Task" |
|
int — task number |
6117 | Directory field type "Project" |
|
int — project number |
6003 | The entry falls within a directory group |
|
int - directory group identifier |