Ticket API pagination

SOLVE
Regular Contributor

We'd like to have tickets displayed on our site in reverse chronological order, which is no problem until pagination is also a necessity.

When I requests crm-associations/v1/associations/VID/HUBSPOT_DEFINED/15 without a limit, I get the ticket IDs sort in ascending order by ID. I can get the details of these tickets and then sort how I need them to display.

However, if the user has more than 10 tickets (or whatever the limit), then I can only sort those 10, which will be the oldest tickets, by the order I want.

So my question is, is there a way to specify how we want them sorted in the request? If not, how would you recommend we accomplish this? Thanks!

1 Accepted solution

Accepted Solutions
HubSpot Moderator

Hi @kakigori, I understand that you connected with Support and chatted with Nick yesterday. Do you still need assistance with this?

If so, I'm seeing that the ticket IDs are being returned oldest to newest, but confirmed with the CRM team that there's absolutely no guarantee the order that they're returned. There's no way to specify this order in the request, so the only conceivable way to find out the proper order would be to get all the associated ticket IDs first, then make a call to GET all of those ticket objects and sort them off of their create date.

Hope this helps clarify some things!

Reply
0 Upvotes
2 Replies 2
HubSpot Moderator

Hi @kakigori, I understand that you connected with Support and chatted with Nick yesterday. Do you still need assistance with this?

If so, I'm seeing that the ticket IDs are being returned oldest to newest, but confirmed with the CRM team that there's absolutely no guarantee the order that they're returned. There's no way to specify this order in the request, so the only conceivable way to find out the proper order would be to get all the associated ticket IDs first, then make a call to GET all of those ticket objects and sort them off of their create date.

Hope this helps clarify some things!

Reply
0 Upvotes
Highlighted
Regular Contributor

Thanks, @Connor_Barley. I definitely noticed the inconsistent order the IDs were returned in when getting details from associations. I was hoping not to have to keep making requests to get a user's tickets like that, but it seems like it's the only way to achieve what we want at the time being.