API /api/v2/tickets with total count of the results

Hi,

I would like the /api/v2/tickets api to be able to return the number of results all the time when I call it with pagination because at the moment, I only have a list of tickets with no total.

Example of my call:
api/v2/tickets?email=XXXX&company_id=XXXX&per_page=5&page=1

I need the result to be able to manage pagination in Angular with the next/previous button.

I’ve seen that another service offers this:
/api/v2/search/tickets?query=[query]

but I can’t do my filter email,company_id and per_page

Example:
api/v2/search/tickets?query="email:XXXX"&per_page=5&page=1
Response:

"field": "per_page",
            "message": "Unexpected/invalid field in request",
            "code": "invalid_field"

without the per_page:

"field": "email",
            "message": "Unexpected/invalid field in request",
            "code": "invalid_field"

To solve my problem, 2 solutions:

  • Add the total to the /api/v2/tickets service

OR

  • Add the email, company and per_page filter to the service api/v2/search/tickets?query=

Can you help me?

Thank you

Have a nice day

Dany

Hi @Dan_Asc ,
An alternative solution could be to search for any status value.
eg:
/api/v2/tickets/filter?query=“status:2 OR status:3 OR status:4 OR status:5 OR status:6”

Currently, a direct implementation of a comprehensive pagination feature is not available. However, we do have a workaround that allows us to achieve partial pagination functionality.

  1. Filter API:

Please refer to points 8 and 9 in the documentation; they outline an option to include a ‘page’ parameter in the query. By default, this parameter is set to return 30 records (this value cannot be changed). To implement pagination, you can build your UI to display 30 records per page or, alternatively, employ logic to only render 5 or 10 records per page while the API continues to provide 30 records per response. It’s important to note that this API has a limitation—only up to 10 pages can be accessed using this approach (see Note 9).

  1. List API:

The List API offers pagination functionality, allowing for navigation through ‘next’ and ‘previous’ pages. However, it does not provide the total number of records to the end user. If a ‘next’ request results in an empty response, you should render a message indicating that no more records are available. (A maximum of 300 pages (9000 tickets) will be returned.)

@ajithr Interesting post as I’ve attempted to implement pagination and this is good information to have documented. I’ve also had challenges with Search in Knowledge having odd meta data returned making it challenging to page.

What determines the filter properties available on objects? As the schema changes and properties are added, what allows something to be filterable? The assumption is the data is stored as NoSql and the API is querying that directly, so are those the properties that are indexed? With limited filter options and limitations on records returned, the assumption is the developer is going to hit some walls. This is going to much more prevalent in Enterprise accounts that have large record counts. We have some customers starting with wanting hundreds of thousands of records imported, so is there anything on the roadmap to provide pagination capabilities, additional filter properties and\or increase record limits? One I’ve seen in forums is filtering on ticket type, specifically Service Requests (SR) with other criteria.