How many pages are in my API result?
search cancel

How many pages are in my API result?

book

Article ID: 284417

calendar_today

Updated On:

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.  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"])