REST API: Complex task filters

From Planfix
Jump to: navigation, search

Complex task filters in REST API Planfix are used in the "/task/list" method when retrieving a list of tasks.Task filters are specified with the following parameters:

  • type — numeric identifier of the filter type. The field type determines it according to

which the selection is made in the filter. The "Type" column in the table below.

  • operator — filter operator, one of the values from the list (equal, notequal, gt, lt), different filters can have different allowed operators, for fields of "Date" type, you can also use the operators gtAndEqual and ltAndEqual.
  • value — filter value, can be a string, a number, or a complex object, depending on the filter type.
  • field — identifier of the custom field, for filters by custom fields.
  • subfilter — identifier of the custom field, for filters by custom fields.
{
    "type": 12,
    "operator": "equal",
    "value": {
        "dateType": "otherDate",
        "dateValue": "22-03-2022"
    }
}


Example of a request to get a list of tasks with the transfer of multiple filters (AND logic is used):

{
  "fields": "name",
  "filters": [{
        "type": 2,
        "operator": "equal",
        "value": "user:5"
     },
     {
        "type": 2,
        "operator": "equal",
        "value": "contact:7"
     },
     {
        "type": 2,
        "operator": "equal",
        "value": "group:8"
     }
  ]
}


Тип Name Operators Format value
12 Creation 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": "20-03-2022",
    "dateTo": "22-03-2022"
}
"value": {
    "dateType": "otherDate_withTime",
    "dateFrom": "20-03-2022 12:00",
}
13 Planned start date
14 Planned due date
21 Date of last activity (last added comment)
19 Actual due date
20 Completion date
38 Latest change date
79 Date of the latest change or comment
103 Custom field type "Date"
1 Assigner
  • equal
  • notequal
string - employee/contact/group number with a prefix.

For example: “user:1”, “contact:5”, “group:3”

2 Assignee
39 Participant
3 Task or project auditor
59 Project auditor
60 Task auditor
108 Custom field type "Contact"
109 Custom field type "Employee"
112 Custom field type "Group, employee, contact"
113 Custom field type "List of employees"
22 Without a start date
  • equal
int - 1

boolean - true

23 Without a due date
25 With a start date
26 With a due date
16 Recurring
28 Non-recurring
17 Overdue
29 Not overdue
33 Without assignees
41 Without participants
34 Assigner-employee
35 Assigner-contact
71 Assignee - employee
69 Assignee - contact
72 Participant - employee
70 Participant-contact
8 Task name
  • equal
  • notequal
string - contains/does not contain filter is applied
101 Custom field type "String"
  • equal
  • notequal
  • have
  • nothave
string - equal/not equal/ contains/does not contain filter is applied
102 Custom field type "Number"
  • equal
  • notequal
  • gt
  • lt
int
105 Custom field type "Checkbox "
  • equal
  • notequal
int - 1 / 0

boolean

106 Custom field type " List"
  • equal
  • notequal
string
107 Custom field type "Directory entry"
  • equal
  • notequal
int - entry identifier
114 Custom field type "set of directory entries"
  • equal
  • notequal
int - entry identifier, for condition by several entries — identifiers through; (semicolon)
152 Contains a value in custom field
  • equal
int - field identifier
153 Doesn't contain a value in custom field
  • equal
int - field identifier
11 Contains a data tag
  • equal
int - Data tag identifier
18 Doesn't contain a data tag
  • equal
int - Data tag identifier
73 Direct Parent task
  • equal
  • notequal
int - Parent task number
57 Task number
  • equal
  • notequal
int - task number or a series of task numbers for conditions on multiple numbers (OR)
115 Custom field type "Task"
117 Custom field type "Project"
  • equal
  • notequal
int - project number
51 Template
  • equal
  • notequal
int - template number or a series of template numbers for conditions on multiple numbers (OR)
5 Project
  • equal
  • notequal
int - Project number
10 Status
  • equal
  • notequal
int - status identifier or a series of status identifiers for conditions by several statuses (OR)
7 Counterparty
  • equal
  • notequal
int - Counterparty number

string - counterparty number with a prefix, example: "contact:1"

24 Process
  • equal
  • notequal
int - process identifier
307 Parent task tree
  • equal
  • notequal
int - Parent task number
93 The value of the data tag field

(depending on the field type)

  • equal
  • notequal
  • gt
  • lt
  • have
  • nothave
The value of the data tag field to be filtered by the subfilter field must also be passed in the filter structure; an example of filtering a data tag field of type String:
{
  "offset": 0,
  "pageSize": 100,
  "filters": [
    {
      "type": 93,
      "operator": "equal",
      "value": "Test value",
      "subfilter": {
        "dataTagId": 6,
        "filter": {
          "type": 3108,
          "field": 20
        }
      }
    }
  ],
  "fields": "id,name,dataTags"
}

where:

  • dataTagId — data tag identifier.
  • filter — filter object for this data tag.
  • type — filter type, in this case, a complex data tag filter for a field of type "String".
  • field — data tag field identifier, by which the filtering is performed.

Go To