Listing tickets (by filter)

This method allows you to return all the tickets which match a filter.

URL

/api/v2/tickets/filter

Access

This method can be accessed by account tokens and user tokens where the associated user has access to the tickets UI.

Supported Parameters

  • filter - the name or ID of the filter you wish to use (required)
  • user - the username or ID of the user you wish to run the filter as (optional)
  • page - the page number to return tickets for (optional, defaults to 1)
  • sort and order - can be used to manually change the order (optional, defaults to the filter defaults)
  • conditions - can be used to pass additional conditions which will be added to the filter query (optional)
  • raw - if this is set to 1, the full ticket information will be returned rather than just the columns selected for the filter (optional)

Additional Conditions

To apply additional conditions on your filters results pass a set of conditions parameters, with the key representing the field you wish to query, and the value representing the data you want to search for, for example:

conditions[status] = 'new'
conditions[priority] = 'high'

Returned Data

The API will return information about the filter as well as paginated ticket results (30 per page). The ticket data will only include data for the columns required by the filter along with the ticket reference.

Example JSON

{
    "filter": {
        "id": 1,
        "name": "My Teams' Tickets",
        "description": "Display all open tickets which are assigned to my team",
        "icon": 5,
        "order": "desc",
        "sort": "updated_at",
        "conditions": {
            "all": [
                {
                    "var": "team",
                    "operator": "in",
                    "data": null
                }
            ],
            "any": [
                {
                    "var": "status",
                    "operator": "equal",
                    "data": "1"
                },
                {
                    "var": "status",
                    "operator": "equal",
                    "data": "2"
                }
            ]
        },
        "cols": [
            "status",
            "source",
            "details",
            "contact",
            "priority",
            "updated_at"
        ]
    },
    "records": [
        {
            "reference": "UU-121002",
            "cols": [
                {
                    "name": "New",
                    "colour": "77c300"
                },
                "User",
                "asd",
                "another message!",
                {
                    "text": "Normal",
                    "colour": "0097cf"
                },
                "2013-02-13T11:47:05Z"
            ]
        },
        {
            "reference": "HR-352858",
            "cols": [
                {
                    "name": "New",
                    "colour": "77c300"
                },
                "User",
                "test",
                "adam@atechmedia.com",
                {
                    "text": "Normal",
                    "colour": "0097cf"
                },
                "2013-02-13T11:46:54Z"
            ]
        }
    ],
    "pagination": {
        "page": 1,
        "offset": 0,
        "per_page": 30,
        "pages": 1,
        "total_records": 2
    }
}

Proudly powered by Katapult. Running on 100% renewable energy.