More than 30....

  • 13 March 2018
  • 5 replies
  • 34 views

Due to the number of tickets we have, when I use the API to run customized reports I was running out of requests.  So I build a cache systems to get information once so I do not have to call it multiple times.  This worked great except now I am only getting 30 companies per request.  It is like the filter features was applied to the "All Companies" request.  How do we get around this limitation.  Calling each page and then joining the JSON to a single stream is mess load of code and unnecessary development.



5 replies

Hello Kenneth,


By default, the API endpoints will return 30 objects per page. You can use the page number attribute to traverse through the lists. Also, you can specify the per_page attribute to obtain a maximum of 100 results per page. 


Cheers!

Have the same issue.....  I want to get all of my tickets,  and/or filter all tickets on a particular subject...  


Hi…. We’re trying to query our FD database for all tickets
that have the word “Workbook” in the subject.  I was thinking the
easiest way for us to do this is just to do a query for all tickets:


https://ttardsupport.freshdesk.com/api/v2/tickets?updated_since=2015-08-17 
and then do a search within the JSON which is returned with another tool. 

 

However, with the call above,  I get just the first 30
results…. How can I get all results? 

 

And then if possible,  can I filter on
subject? 

 

Thanks! 

 

---- Larry 


Hi Larry,


Unfortunately, the filter cannot be made using the subject line of the ticket. It can run on various other parameters as explained here.


By default, Freshdesk returns 30 objects per page for an API request. You can include per_page parameter to get upto 100 objects per page and then poll through all the pages to obtain the complete list of objects.


Cheers!

Also, I note in the docs, under filter tickets #8, suggests that the total number of available records is returned, However, I don't see this in my response,

"8. The number of objects returned per page is 30 also the total count of the results will be returned along with the result"


In PowerShell, the returned object includes the following members: (click to expand...)


Name             MemberType   Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
cc_emails NoteProperty Object[] cc_emails=System.Object[]
company_id NoteProperty object company_id=null
created_at NoteProperty string created_at=2018-04-18T07:42:42Z
custom_fields NoteProperty System.Management.Automation.PSCustomObject custom_fields=@{project=; cherwell_sra=; lrdp...
description NoteProperty string description=<div dir="ltr">Hi Sir,<div><br></div>...
description_text NoteProperty string description_text=Hi Sir,...
due_by NoteProperty string due_by=2018-04-20T21:00:00Z
email_config_id NoteProperty object email_config_id=null
fr_due_by NoteProperty string fr_due_by=2018-04-18T21:00:00Z
fr_escalated NoteProperty bool fr_escalated=False
fwd_emails NoteProperty Object[] fwd_emails=System.Object[]
group_id NoteProperty object group_id=null
id NoteProperty int id=4893
is_escalated NoteProperty bool is_escalated=False
priority NoteProperty int priority=1
product_id NoteProperty object product_id=null
reply_cc_emails NoteProperty Object[] reply_cc_emails=System.Object[]
requester_id NoteProperty long requester_id=17009379855
responder_id NoteProperty object responder_id=null
source NoteProperty int source=1
spam NoteProperty bool spam=False
status NoteProperty int status=2
subject NoteProperty string subject=Egnyte account
to_emails NoteProperty Object[] to_emails=System.Object[]
type NoteProperty object type=null
updated_at NoteProperty string updated_at=2018-04-18T07:42:42Z


Can I get a list of the total tickets in the system,  including archived tickets so if I'm polling by page number, I know how many pages to ask for?    


Reply