REST API: Complex employee filters
From Planfix
Complex filters in REST API Planfix are used in the "/user/list" method when obtaining a list of employees. The following set of parameters sets employee filters:
- type — numeric filter identifier.
- operator — filter operator, one of the list values (equal, notequal, gt, lt). Different filters may have different allowable operators.
- value — filter value, depending on the filter type. It can be a string, number, or complex object.
- field — identifier of the custom directory field performed by the filter.
Example of a request to get a list of employees with several filters by a custom field of type "Date" and a custom field of type "Employee" (AND logic is used):
{
"offset": 0,
"pageSize": 100,
"fields": "id,name,description,3,5",
"filters": [
{
"type": 5103,
"field": 3,
"operator": "equal",
"value": {
"dateType": "otherRange",
"dateFrom": "15-12-2022",
"dateTo": "17-12-2022"
}
},
{
"type": 5109,
"field": 5,
"operator": "equal",
"value": "user:50"
}
]
}
| Type | Name | Operators | Format value |
|---|---|---|---|
| 9103 | Employee field type "Date" |
|
Object :
"value": {
"dateType": string,
"dateValue": string,
"dateFrom": string,
"dateTo": string
}
dateType accepts the following values:
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",
}
|
| 9120 | Employee's birth date | ||
| 9108 | Employee field type "Contact" |
|
string - employee/contact/group number with a prefix.
For example: “user:1”, “contact:5”, “group:3” |
| 9109 | Employee field type "Employee" | ||
| 9110 | Employee field Type "Counterparty" | ||
| 9112 | Employee field type "Group, employee, contact" | ||
| 9113 | Employee field type "Employee list" | ||
| 9006 | Employee's full name (search can be performed by part of the full name) |
|
string — contains/does not contain filter is applied |
| 9121 | Employee's first name | ||
| 9122 | Employee's middle name | ||
| 9123 | Employee's last name | ||
| 9101 | Employee field type "String" |
|
string - equal/not equal/ contains/does not contain filter is applied |
| 9008 | Employee number |
|
int |
| 9102 | Employee field type "Number" | ||
| 9105 | Employee field type "Checkbox" |
|
int — 1/0 boolean |
| 9106 | Employee field type "List" |
|
string |
| 9107 | Employee field type "Directory entry" |
|
int — entry identifier |
| 9111 | Custom field type "Value set" |
|
string - value, for condition by several values — value through; (semicolon) |
| 9115 | Employee field type "Task" |
|
int — task number |
| 9117 | Employee field type "Project" |
|
int — project number |
| 9001 | Employee group |
|
int — group identifier |
| 9002 | Employee's phone number |
|
string — contains/does not contain filter is applied |
| 9004 | Employee's short number | ||
| 9003 | Employee's external email | ||
| 9005 | Employee's position |
|
string — position name |
| 9124 | Employee's language |
|
string — language code, for example: "En" |
| 9126 | Telegram ID |
|
int - Telegram ID |