Hello Calendly Developer Community,
I'm encountering a critical issue with the "List Events" endpoint in the Calendly API, specifically related to the pagination functionality. I'm hoping to get some insights or assistance from the community.
Here's a detailed description of the problem:
- Initial Request Success: The first API call to the "List Events" endpoint to retrieve 100 events works as expected.
- Pagination Issue: However, when I attempt to make a subsequent call using the
page_token
parameter (which I received from the initial request) for the next set of events, the API returns a 400 error. This suggests a problem with the pagination implementation. - Environment: I've encountered this issue consistently in both Python and Make (Integromat) environments.
- Comparison with Other Endpoints: To isolate the problem, I've tested pagination with other endpoints, such as the one used for routing forms, and it worked correctly there. This indicates that the issue seems specific to the "List Events" endpoint.
Has anyone else experienced this problem? Any advice or guidance on how to resolve or work around this issue would be greatly appreciated. If additional technical details are needed for troubleshooting, I'm happy to provide them.
Thank you in advance for your help and insights!
Here is python code↓
def get_calendly_events():
base_url = "https://api.calendly.com/scheduled_events"
params = {
"count": 100,
"organization": "https://api.calendly.com/organizations/EHEAVSKRBRWALXMU",
"max_start_time": "2024-02-07T23:30:00Z",
"min_start_time": "2023-09-14T13:16:00Z"
}
headers = {
'Authorization': f'Bearer {token}' # Replace with your access token
}
events = =]
# i = 0
while True:
response = requests.get(base_url, headers=headers, params=params)
response.raise_for_status() # Will raise an exception for HTTP errors
data = response.json()
filtered_data = filter(lambda x: x 'event_type'] == target_event_type,data.get('collection', ,]))
if filtered_data:
events.extend(filtered_data)
next_page_token = data.get('pagination', {}).get('next_page_token')
pprint(data.get('pagination', {}))
if not next_page_token:
break
# if i == 0:
# del paramsm'min_start_time']
sleep(0.15)
paramsm'page_token'] = next_page_token
# i+=1
return events
Here is the pic of the predefined backend request of Make module failing.