I am developing an external app and need to fetch the first 30 tickets after ordered by a custom number field.
I only need the 30 highest ranked tickets. The number field’s value will be any value between 0 and 1000.
Additional filter criteria (group_id or agent_id) needs to be applied aswell.
Can I achieve this with just one api call? So is there a way to order by a custom field in search tickets API?
Is there a way with Filter tickets API?
Or do I have to download each and every ticket and do the sortation in the external application?
you are able to filter tickets based on custom fields,
say for eg:
Get the list of locked tickets belong to Finance or Marketing sector (Custom Fields: locked, sector).
**"(cf_sector:'finance' OR cf_sector:'marketing') AND cf_locked:true"**
curl -v -u yourapikey:X -X GET 'https://domain.freshdesk.com/api/v2/search/tickets?query="(cf_sector:%27finance%27%20OR%20cf_sector:%27marketing%27)%20AND%20cf_locked:true"'
Thank you for your answer.
Unfortunately, it does not solve my question.
What I exactly need would be any possibility to sort by a custom field an not to filter.
I only need to extract just 25 or 30 tickets out of many tickets I’d get.
My exact usecase is to implement a QA tool, where supervisors will go through a ticket list, extracted by an app and sorted RANDOMIZED - So, any 25 tickets, which come first will get through a QA check by supervisors.
My approach was to create a ticket field where a random value is stored by an app on ticket creation.
An external application then does the Filter tickets API sorts them after this random value and extracts only the 25 highest ranked tickets.
The best approach would be to get only the 25 highest ranked tickets, as otherwise I would have to extract and fetch all tickets (which may be a few thousands) and sort them in the external app just to get only the 25 highest ranked.
Would that be possible? Or any other idea how to sort before fetching tickets?
unfortunately, for now, there is no such API is supported to sort by custom field.
the only way is to filter the tickets via Filter tickets API and then you need to sort them in your external application.