Determine page count in my API result
search cancel

Determine page count in my API result

book

Article ID: 284417

calendar_today

Updated On: 06-09-2025

Products

CloudHealth

Issue/Introduction

The best practice for handling pagination with the CloudHealth API, to retrieve all results from a request, is to loop while links do exist.

Resolution

An example:

while links.get('next'):
new_url = "https://chapi.cloudhealthtech.com"+url["_links"]["next"]["href"]
#print(new_url)
url = requests.get(new_url, params=url_params).json()
links = url["_links"]
org_list.extend(url["organizations"])