Question

Sorting fetched events based on "updated_at"

  • 24 January 2024
  • 3 replies
  • 72 views

When using the following API end point https://stoplight.io/mocks/calendly/api-docs/395/event_types

for fetching the List Of User's Event Types we have the option to sort and fetch the events on the basis of name using the sort option in the query parameters as mentioned here https://developer.calendly.com/api-docs/25a4ece03c1bc-list-user-s-event-types

 

sort

string

Order results by the specified field and direction. Accepts comma-separated list of {field}:{direction} values. Supported fields are: name. Sort direction is specified as: asc, desc.

Default:

name:asc

Example:

name

 

We see that there is no other option we can pass. Is there a way we can fetch the events based on the update_at of an event in descending order?


FYI: We are integrtating calendly in our CMS app, where we are making request to calendly to list user's events. It gives default 20 events sorted by Name
This will be not useful if user has multiple events and hence looking for a way to fetch latest updated events of user.


3 replies

Userlevel 2

Hi again!

We don’t currently have any sort method besides name, as listed in the documentation. With that said, I can definitely understand preferring to sort by the updated date so that you don’t have to call for the entire collection if you are just looking for event types with recently modified settings. We’re passing on this request for consideration by our Product team and appreciate you sharing your use case!

In case you are integrating this too, our list events endpoint will allow you to sort by start time and provide a range of start times to get your results from.

I know I mentioned pagination in response to your earlier post yesterday, but I wanted to bring it up again here in case another developer runs into the same question:

While the default count (results per page) will be 20, you can increase this to 100. This will also determine the maximum number of results per page, so you can continue to call for more data after this. We have a section in our API conventions page that contains more general information on this.

In a case like this, you would need to call for the entire collection and then sort by updated_at date on your end to sort all the event types.

 

Hello @marion-calendly ,

Thanks for your prompt response, and we're grateful for forwarding our request for consideration to your product team.

To ensure we're aligned, we'd like to provide a brief overview of our use case.

In our CMS app, we've incorporated the ability for users to integrate Calendly, utilizing the API to retrieve event_types. These event types are then presented to the user through a select dropdown.

Our concern lies in the current sorting mechanism. If, for instance, we want to retrieve only 20 events and they're arranged alphabetically, there's a possibility that users may not see their newly created event in the dropdown.

Additionally, we would like to inquire about the anticipated timeframe for a potential update to the sorting parameter in the API.

Thank you once again for your assistance.

Userlevel 2

 Hey @jas35105 , thanks so much for outlining your use case further!

We’ve submitted this as a feature request to the Product team, but they would decide if or when they would want to implement this when they review the request. Hearing developer use cases and pain points definitely helps them prioritize.

I’m not sure if this suits your use case but if you want to make sure you display all the user’s event types, you could call for every page of results. Then, you could sort the results on your end (e.g. by the updated date, which will be provided on every event type in the collection) before presenting the options in a dropdown. If you only wanted to display the most recent results, you could restrict the collection after sorting too.

Thanks once again for taking the time to outline your feedback in detail! I also hope this solution can work for you right now.

Reply