Skip to main content

Hi Support,

We are planning to build a new client portal using the Freshdesk APIs with a view of replicating all of the features of your existing portal plus a new UI and additional features.

We wanted to get your advice on the best approach to get the number of pages.

We want to have paginator on our portal. On one page we display 10 tickets. But how can we get the total number of such pages?

Is there any way how you can add this data to the API or you could suggest some better approach.

Thanks!



While not ideal you could always figure it out by dividing your page out from results.

  

            foreach (JObject parsedObject in parsedArray.Children<JObject>())

{

foreach (JProperty parsedProperty in parsedObject.Properties())

{

string propertyName = parsedProperty.Name;

//If property name is total this is the total number of records you got back from your request

if (propertyName.Equals("total"))

{

string totalValue = (string)parsedProperty.Value;



if (decimal.TryParse(totalValue, out decimal totalInt))

{//Since you got more than 10 records find out how many pages you have

if (totalInt > 10)

{

decimal pageTotal = totalInt / 10;

decimal roundedTotal = Math.Ceiling(pageTotal);//Round up if you get 3.1 pages so you know to grab 4 pages

}

}



}