REST API: Complex project filters

From Planfix
Revision as of 07:58, 29 February 2024 by Dmitri (talk | contribs) (Created page with "{{#seo: |title=REST API: Complex Project Filters |titlemode=append |keywords=planfix, project filters, api, rest, rest api, complex project filters |description=REST API: Complex Project Filters }} Complex filters in REST API Planfix are used in the "/project/list" method to obtain a list of projects. Project filters are set by the following parameters:: *'''type''' — numeric identifier of the filter. *'''operator''' — filter operator, one of the val...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Complex filters in REST API Planfix are used in the "/project/list" method to obtain a list of projects. Project filters are set by 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 the custom data tag field by which the filter is performed.


Example of a request to get a list of projects 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": "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"
    }
  ]
}


Тип Name Operators Format value
5103 Project field type "Data"
  • equal
  • notequal
  • gt
  • lt

Объект :

 
"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",
}
5005 Due date
5013 Creation date
5004 Author
  • equal
  • notequal

string - employee/contact/group number with a prefix. Например: “user:1”, “contact:5”, “group:3”

5008 Customer Manager
5012 Auditor
5011 Assignee
5108 Project field type "Contact"
5109 Project field type "Employee"
5110 Project field type "Counterparty"
5112 Project field type "Group, employee, contact"
5113 Project field type "Employee list"
5001 Project name
  • equal
  • notequal

string - contains/does not contain filter is applied

5101 Project field type "String"
  • equal
  • notequal
  • have
  • nothave
string - equal/not equal/ contains/does not contain filter is applied
5007 Project number
  • equal
  • notequal
  • gt
  • lt

int

5102 Project field type "Number"
5105 Project field type "Checklist"
  • equal
  • notequal
int - 1 / 0

boolean

5106 Project field type "List"
  • equal
  • notequal
string
5107 Project field type "Directory entry"
  • equal
  • notequal
int - entry identifier
5115 Project field type "Task"
  • equal
  • notequal
int - task number
5117 Project field type "Project"
  • equal
  • notequal
int - project number
5002 Project group
  • equal
  • notequal
int - group identifier
5006 Project status
  • equal
  • notequal
int - status identifier
5010 Template
  • equal
  • notequal
int - template number
5003 Counterparty
  • equal
  • notequal
int - counterparty number

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

5014 Subproject
  • equal
  • notequal
int - subproject number


Перейти