Incorrect sort order when querying some API endpoints | The place for Zendesk users to come together and share
Skip to main content
Question

Incorrect sort order when querying some API endpoints

  • June 13, 2024
  • 1 reply
  • 2 views

Hi there,
We've noticed that the following endpoints return incorrect order when we use the sorting feature:

  1. https://<redacted>.zendesk.com/api/v2/group_memberships.json?page=0&sort_by=updated_at&sort_order=desc
  2. https://<redacted>.zendesk.com/api/v2/ticket_fields.json?page[size]=100&sort=-updated_at
  3. https://<redacted>.zendesk.com/api/v2/ticket_forms?page=0&sort_by=updated_at&sort_order=desc

They all should've returned all records in descending order based on the “updated_at” field.

For example:

returns the records in correct order.

 

Are you able to reproduce the issue? Or did we miss something?

1 reply

Greg29
  • Employee
  • June 13, 2024

Hi Hieu! Not all of our endpoints support the pagination sort method that you are using as we document here. This means that if something isn't returning as you would expect and doesn't have a documented sort order option, it is not actually a supported query.