REST API: Complex data tag filters

From Planfix
Jump to: navigation, search

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"
  • equal
  • notequal
  • gt
  • lt

Object:

 
"value": {
    "dateType": string,
    "dateValue": string,
    "dateFrom": string,
    "dateTo": string
}

dateType accepts the following values:

  • today
  • yesterday
  • tomorrow
  • thisWeek
  • lastWeek
  • nextWeek
  • thisMonth
  • lastMonth
  • nextMonth
  • last - last n days, n is passed in dateValue
  • next - next n days, n is passed in dateValue
  • in - in n days, n is passed in dateValue
  • otherDate - exact date, date is passed in the format dd-mm-yyyy in dateFrom
  • otherRange - exact period, dates are passed in the format dd-mm-yyyy in dateFrom and dateTo
  • otherDate_withTime - exact date-time, date is passed in the format "dd-mm-yyyy hh:mm" in dateFrom
  • otherRange_withTime - exact period with specified time, dates are passed in the format "dd-mm-yyyy hh:mm" in dateFrom and dateTo

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"
  • equal
  • notequal

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"
  • equal
  • notequal
  • have
  • nothave
string - equal/not equal/ contains/does not contain filter is applied
3109 Custom field type "Number"
  • equal
  • notequal
  • gt
  • lt
int
3115 Custom field type "Checkbox"
  • equal
  • notequal
int - 1 / 0

boolean

3105 Custom field type "Directory"
  • equal
  • notequal
int - entry identifier

Go To