REST API: Complex directory filters

From Planfix
Jump to: navigation, search

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"
  • 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": "01-12-2022",
    "dateTo": "06-12-2022"
}
"value": {
    "dateType": "otherDate_withTime",
    "dateFrom": "30-12-2022 12:00",
}
6108 Directory field type "Contact"
  • equal
  • notequal
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"
  • equal
  • notequal
string - contains/does not contain filter is applied
6101 Directory field type "Employee list"
  • equal
  • notequal
  • have
  • nothave
string - equal/not equal/ contains/does not contain filter is applied
6102 Directory field type "Number"
  • equal
  • notequal
  • gt
  • lt
int
6105 Directory field type "Checkbox"
  • equal
  • notequal
int - 1/0
boolean
6005 Is the entry archived
6106 Directory field type "List"
  • equal
  • notequal
string
6107 Directory field type "Directory entry"
  • equal
  • notequal
int - entry identifier
6114 Directory field type "Set of directory entries"
  • equal
  • notequal
int — entry identifier, for condition by several entries — identifiers through; (semicolon)
6115 Directory field type "Task"
  • equal
  • notequal
int — task number
6117 Directory field type "Project"
  • equal
  • notequal
int — project number
6003 The entry falls within a directory group
  • equal
  • notequal
int - directory group identifier


Go To