This article explains how to manage large sets of data by paginating through results in the DroneDeploy REST API. When an API request returns a list of results, the system limits the number of items per response to ensure performance.
Availability: Who has access?
Enterprise users with API access.
Access requires a valid API Key generated from the Account Preferences menu.
How to use API pagination
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.
Key Details
Default Limit: Most list endpoints default to 50 items per page.
Link Header: DroneDeploy follows RFC 5988 standards for web linking.
Authentication: Ensure the
api_keyparameter is included in every paginated request.
V2.2