Is there a way to search for tickets in API using a keyword?

  • 31 August 2018
  • 5 replies
  • 1000 views

Hi, i want to search tickets on basis of Title or Description with the help of API.So far i can get all the tickets or a specific ticket using this "/api/v2/tickets/" but i would like to know if there is a way to filter/search using a specific key word with the API.


Something like this "/search/tickets?term=bug" or /search/tickets?query=bug


Thank you



5 replies

Userlevel 4
Badge +12

Hello Satwant,


Filter tickets API allows you to search for tickets that are grouped together under a common criteria. It can be the default system fields like type, group, tags etc. or even your custom text/dropdown fields. Do you think this would help though it doesn't filter by subject?


Cheers!


Hi Aravind,


Thanks for the reply. I don't need to filter by subject necessarily as long as the ticket contains the word i am looking for. Could you give me an example of custom text field?


Userlevel 4
Badge +12

Hello Satwant, 


Here's a sample query I've constructed to filter tickets with a specific keyword in one of the custom text fields.


curl -v -u APIKEY:X -X GET 'https://domain.freshdesk.com/api/v2/search/tickets?query="(cf_testing:%27Test%27)"'

Here, cf_testing is the custom field name and the keyword is Test. As highlighted here, the query parameter has been URL encoded.


Cheers!


Till today this doesn't return any values

 

{
"results": [],
"total": 0
}

 


Userlevel 5
Badge +9

Hello!


Every query used to filter tickets via API should be constructed based on the ticket fields, either default or custom configured in your helpdesk. The below documentation link would help you get detailed insights on the same:

https://developer.freshdesk.com/api/#filter_tickets


If you are still facing trouble getting the API results, please drop an email to support@freshdesk.com and we would be happy to help!


Cheers. :)

Reply