Filtering tickets on API v2

  • 6 January 2016
  • 20 replies
  • 1478 views

We're using API v1 to find any new tickets matching a custom view (aka filter) which works well. 


API v2 looks like a great evolution, but it only allows filtering according to four pre-defined filters, with the error response (NB, errors much improved since v1!):


   Should be a value in the list 'new_and_my_open,watching,spam,deleted'


Are you planning to open this up to allow either filtering by a custom view or more dynamic filtering in the parameters passed to the API?






This topic has been closed for comments

20 replies

Thank you for your feedback, Simon. We are planning to take the latter approach i.e more dynamic filtering. Could you tell us a bit more about the parameters that you want to use to filter your tickets.


Thanks for the response Rohit, sounds promising and certainly we'd prefer a more dynamic approach than having to predefine filters.


We're quite new to Freshdesk so I'm sure we'd use more complex criteria in the future, but right now we're filtering by statustag, and product. To give a little more detail, we use a Scenario to escalate a ticket, which will add a new tag and set the status on the ticket amongst other things. We run a periodic process to query the API to discover any such tickets relating to a product, and create a corresponding Request within TargetProcess before resetting the status on the ticket. 


This works fairly well currently, though we'd be very happy to see an integration with TargetProcess instead!





I'd also like to have morte filter options for tickets in the v2 API. 


Usage of predefined filters would have been a solution but even better to could use the same parameters which are used to build the filter. E.g. type=mycustomtype


Userlevel 4
Badge +12

Hi ,




We've recently launched filter tickets API on V2 . Please check this section for the endpoint and sample API call : https://developer.freshdesk.com/api/#filter_tickets




Cheers!



The filter_tickets option is great, but I can't figure out how to filter by agent / responder_id. And I need a way to sort the results . . . Any ideas?


Userlevel 4
Badge +12

Hi Simon,




As of now, the filter tickets ( in BETA ) api supports filtering by group_id. It is not possible to filter by agent-id . We'll see if we can get this added in future.




Cheers!



Okay, I'll wait for filtering by agents . . . What about sorting the results?



Any advancement, more fields, sorting, etc on the filter tickets endpoint will be a big help. This is a very powerful new api addition!



We have an 'issue' field we need to filter issues by. It is listed in the 'ticket_fields' API endpoint, but any attempt to use the Filter API to filter by that field returns a 400 Bad Request.




Why won't it filter on custom fields?




--


Ross


Userlevel 4
Badge +12

Hello Ross,



I have created a support ticket for this issue and will connect for further details.




Cheers!


Userlevel 4
Badge +12

Update:




The filter tickets (Beta) api supports only single line text ,number and checkbox custom fields . 



Cheers!



Do you have any plans to support other custom field types?



That's a nice addition. Do you have plans to add the same embed parameters as in ticket list?




It would have been great to include requester info in the ticket search result. 


For example /api/v2/search/tickets?include=requester&query="type:%27Cancellation%27"


Userlevel 4
Badge +12

@Ross: It was earlier in BETA and now it is compatible with other custom field types . Here's the updated link : Filter tickets




@Ronny: That's a nice suggestion . We'll see how we can get them incorporated into the filter tickets API.




Cheers!


Hello,


On v2 API isn't possible to use the user interface created views?



Userlevel 4
Badge +12

@Valdir Although the option to directly fetch the tickets based on a custom view isn't available, you can use Filter tickets API to create a filter similar to the one created via the user interface.


Cheers!

Got it.


We've just lost the ability for the analyst to create filters without developers help.


Let me know with/when you create an endpoint for managing custom views.


Thanks.




Hi....


I have used the search with custom field, but not work for me.


curl -v -u moser@softdata.com.br:pass -H "Content-Type:application/json" -X GET https://softdatabr.freshdesk.com/api/v2/search/tickets?query="os_apigts: '10622'"


My custom field is below:


{
"id": 1000079653,
"name": "os_apigts",
"label": "OS API/GTS",
"description": "",
"position": 14,
"required_for_closure": false,
"required_for_agents": false,
"type": "custom_number",
"default": false,
"customers_can_edit": false,
"label_for_customers": "OS API/GTS",
"required_for_customers": false,
"displayed_to_customers": true,
"created_at": "2013-12-20T17:42:15Z",
"updated_at": "2016-09-08T07:52:01Z"
},


====


Is this feature okay?


Best Regards,


Willian


Userlevel 4
Badge +12

Hello Willian,


Can you please try the following command and see if that works?


curl -v -u email:password -H "Content-Type:application/json" -X GET 'https://softdatabr.freshdesk.com/api/v2/search/tickets?query="os_apigts:10622"'


Cheers!