Skip to main content

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

  • August 31, 2018
  • 6 replies
  • 1663 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

Did this topic help you find an answer to your question?

6 replies

aravind.sundararajan
Skilled Expert
Forum|alt.badge.img+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?


aravind.sundararajan
Skilled Expert
Forum|alt.badge.img+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!



  • Community Debut
  • 2 replies
  • April 22, 2020

Till today this doesn't return any values

 

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

 


hemanth.ramya
Community Manager
Forum|alt.badge.img+9
  • Community Manager
  • 626 replies
  • May 7, 2020

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. :)


slavka
Community Debut
  • Community Debut
  • 1 reply
  • May 9, 2024

None of the responses here really address the question. There seems to be a lot of people having issues with this. To be super clear given the following ticket:

[
  {
    "cc_emails": [],
    "fwd_emails": [],
    "reply_cc_emails": [],
    "ticket_cc_emails": [],
    "fr_escalated": true,
    "spam": false,
    "email_config_id": null,
    "group_id": 1101000205602,
    "priority": 1,
    "requester_id": 50000010459464,
    "responder_id": null,
    "source": 3,
    "company_id": null,
    "status": 2,
    "subject": "hello world tracker",
    "association_type": 3,
    "support_email": null,
    "to_emails": null,
    "product_id": null,
    "id": 53,
    "type": null,
    "due_by": "2024-05-06T16:00:00Z",
    "fr_due_by": "2024-05-06T16:00:00Z",
    "is_escalated": true,
    "custom_fields": {
      "cf_catagory": null,
      "cf_subcatagory": null,
      "cf_users_office": null,
      "cf_pulse_system_notifcations": null,
      "cf_country_code": null
    },
    "created_at": "2024-05-06T07:25:14Z",
    "updated_at": "2024-05-06T16:15:53Z",
    "associated_tickets_count": 2,
    "tags": [],
    "internal_agent_id": null,
    "internal_group_id": null,
    "nr_due_by": null,
    "nr_escalated": false
  },
  {
    "cc_emails": [],
    "fwd_emails": [],
    "reply_cc_emails": [],
    "ticket_cc_emails": [],

…………..

 

 

I want to be able to run a query and search for the term `hello` or `hello world` and have it match this in the results. Right now i cannot see how this can be done and the docs completely skip over this critical element. 

 

Is there really no way to search tickets using the api?


Reply