Skip to Main Content Site Map
 

API

Download multiple redistricting datasets at one time using the API (Application Programming Interface)

Becoming a designated API user requires:

  1. A verified account
  2. A completed request form
  3. Identity verification (skip if you are from a partner organization)
  4. Access to Jupyter and Python

API Demonstration

How to download multiple datasets using our API

Register for an account to download data

If you do not already have an account, sign up so you can have access to our API. Make sure to verify your email address for your account before you fill out the request form Create Account

Request API Access

Complete the form to request access to the API. If you are the primary contact at an existing stakeholder organization or data partner you are not requiried to go through the verification process. Request Access

Verification Process

If you are not our primary contact at an existing stakeholder organization or data partner, you will need to do an identity verification process and describe the intended use of the data. We do this to ensure the data will not be used to harm others or engage in gerrymandering.

Access the API Script

The GitHub repository contains three files:
  1. Jupyter notebook with API retrieval script with prompts to set parameters RDH_API.ipynb.
  2. Jupyter notebook with API retrieval script with manually setting parameters RDH_API_SET_PARAM.ipynb.
  3. README from GreenInfo (our web developers) with additional information on the WordPress API Download_API.txt.
The jupyter notebooks in this repo can be used to extract data from the RDH API. Designated API users can Run All and fill out the prompts as needed (e.g. username, password, states of interest, filtering parameters, etc.) for the RDH_API script, and set the parameters manually at the top for RDH_API_SET_PARAM script. The scripts use pandas, requests, io, numpy, and getpass libraries. If you do not have these on your system, you may need to install them. You should not have to modify any of the code to retrieve data from the API, which will be extracted to the directory in which this script is housed on your system. You must be a designated API user by RDH in order for the script to work, this is a different status than a normal, verified account. Due to limitations of WordPress API, you can only download data by around 4 states at a time at most, as the API will only pull a list of 1,000 potential datasets for download at a time. The notebook uses pandas version 1.3.1, requests version 2.25.1, and numpy version 1.20.3. The script may run on different versions, but if you are receiving an import error, try installing these versions.

Help Desk

Contact us with your questions or requests about accessing RDH data, or becoming a designated API user Contact by Email