For all of our APIs that return a list of results, the response will be paged.
To load the next page of results, you will need to use the Link header in the response. For example, for /v2/plans, the Link header will look somewhat like this:
Link: <https://public-api.dronedeploy.com/v2/plans/?page_start=1473784311109&api_key={api_key}&limit=50>; rel="next"
Use the URL in this link header for fetching the next page. Below is an example script to page through all Plans and print their log and status:
import sys
import json
import requests
API_KEY = "<api_key goes here>"
next_url = "https://public-api.dronedeploy.com/v2/plans/?api_key={}".format(API_KEY)
plans = []
while next_url:
resp = requests.get(next_url)
if resp.ok:
plans += resp.json()
# Get the next page link from the Link header. See https://tools.ietf.org/html/rfc5988
next_url = resp.links.get('next', {}).get('url')
else:
print "Request failed with {}".format(resp.status_code)
sys.exit(1)
for p in plans:
print "Log: {}, Status: {}".format(
p['log'], p['latest_started_map']['user_status'])
Please check out our API explorer page and our developer page for our new, more robust GraphQL based APIs.