With API v3 you have an option to use filters to get specific results.
Filters for the GET /tickets API to retrieve a list of tickets are especially limited, for more details and all available options please see this article.
Simple filters
Using a simple filter you can filtrate results by searching for a specific column with an exact value:
{"parameter":"value"}
This simple filter allows you to retrieve e.g. tickets with New status:
_filters:{"status":"N"}
You can also combine more conditions in a filter by separating them by a comma, e.g. searching in contacts for all men in a company with a specific ID:
_filters={"gender":"M","company_id":"123abc"}
Using the simple filter, you can search only for a specific value in a parameter, but cannot define operators or use e.g. date ranges. To define operators or search for results within date ranges, use an advanced filter.
Advanced filters
The format of a filter for advanced search requires three values instead of two as in simple filter:
[["parameter","operator","value"]]
As you can see an operator is used in it. With an advanced filter, you can search e.g. for tickets created only this week or all tickets that are not deleted:
_filters=[["date_created","DP","TW"]] _filters=[["status","NI","X,B"]]
You can also combine more conditions into one filter by separating them by a comma, e.g. searching for all postponed tickets created the last month:
_filters=[["status","E","W"],["date_created","DP","LM"]]
Operators used in advanced search
In all advanced filters you can use the following operators:
Boolean operators | ||
---|---|---|
Operator | Description | Example use |
L | Like | [["tags","L","3bg4"]] |
NL | Not like | [["field_player_id","NL","007"]] |
E | Equals | [["status","E","N"]] |
NE | Not equals | [["field_player_id","NE","007"]] |
CY | Contains any of | [["tags","CY","3bg4,9aue"]] |
IN | Is in | [["departmentid","IN","8ld2hdk5,klt0srua"]] |
NI | Not in | [["departmentid","NI","default,8ld2hdk5"]] |
IE | Is empty | [["company_id","IE",""]] |
INE | Is not empty | [["company_id","INE",""]] |
Numerical value operators | ||
---|---|---|
Operator | Description | Example use |
= | Number equals | [["id","=","209"]] |
> | Number greater than | [["id",">","200"]] |
< | Number lower than | [["id","<","51"]] |
>= | Number equals or is greater | [["id",">=","78"]] |
<= | Number equals or is lower | [["id","<=","3"]] |
Date & time operators | ||
---|---|---|
Operator | Description | Example use |
D= | Date equals | [["date_created","D=","2011-11-11"]] |
D> | Date greater than | [["date_changed","D>","2023-01-01 13:00:00"]] |
D< | Date lower than | [["date_created","D>","2022-12-31"]] |
D>= | Date equals or is greater | [["last_activity","D>=","2023-12-24 7:00:00"]] |
D<= | Date equals or is lower | [["date_resolved","D<=","2022-11-30"]] |
T= | Time equals | |
T> | Time greater than | |
T< | Time lower than | |
T>= | Time equals or is greater | |
T<= | Time equals or is lower | |
DP | Date range | [["date_created","DP","TW"]] |
Date & time operators' values | ||
---|---|---|
Value | Description | Example use |
T | Today | [["date_created","DP","T"]] |
Y | Yesterday | [["date_created","DP","Y"]] |
L7D | Last 7 days | [["date_created","DP","L7D"]] |
L30D | Last 30 days | [["date_created","DP","L30D"]] |
L90D | Last 90 days | [["date_created","DP","L90D"]] |
TW | This week | [["date_created","DP","TW"]] |
LW | Last week | [["date_created","DP","LW"]] |
L2W | Last 2 weeks | [["date_created","DP","L2W"]] |
LWW | Last week workdays | [["date_created","DP","LWW"]] |
TM | This month | [["date_created","DP","TM"]] |
LM | Last month | [["date_created","DP","LM"]] |
TY | This year | [["date_created","DP","TY"]] |
LY | Last year | [["date_created","DP","LY"]] |