REST API: Complex data tag filters
From Planfix
Complex filters in REST API Planfix are used in the "/datatag/{id}/entry/list" method when obtaining data tag entries. You can set data tag filters with the following parameters:
- type — numeric identifier of the filter.
- operator — filter operator, one of the values from the list (equal, not equal, gt, lt). Different filters can have different valid operators.
- value — filter value, which can be a string, a number, or a complex object depending on the filter type.
- field — identifier of a field in the custom data tag by which the filtering is performed.
Example of a request to get a list of data tag entries with multiple filters for custom fields of type "Date" and "List of Users" (AND logic is used):
{ "offset": 0, "pageSize": 100, "fields": "dataTag,key,3,2273", "filters": [ { "type": 3101, "field": 3, "operator": "equal", "value": { "dateType": "otherRange", "dateFrom": "15-11-2022", "dateTo": "17-11-2022" } }, { "type": 3103, "field": 2273, "operator": "equal", "value": "user:46" } ] }
Type | Name | Operators | Format value |
---|---|---|---|
3101 | Custom 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": "02-07-2022", "dateTo": "06-07-2022" } "value": { "dateType": "otherDate_withTime", "dateFrom": "30-06-2022 12:00", } |
3106 | Custom field type "Counterparty" |
|
string - employee/contact/group number with prefix. For example: “user:1”, “contact:5”, “group:3” |
3116 | Custom field type "Contact" | ||
3104 | Custom field type "Employee" | ||
3111 | Custom field type "Group, employee, contact" | ||
3103 | Custom field type "List of employees" | ||
3108 | Custom field type "String" |
|
string - equal/not equal/ contains/does not contain filter is applied |
3109 | Custom field type "Number" |
|
int |
3115 | Custom field type "Checkbox" |
|
int - 1 / 0
boolean |
3105 | Custom field type "Directory" |
|
int - entry identifier |