An overview of the Western Pennsylvania Regional Data Center's data API services
The Western Pennsylvania Regional Data Center's data portal (where you can get lots of open data) runs on CKAN. CKAN has an API that allows the user to do things like get a list of all datasets on the WPRDC data portal, get a list of all datasets with resources and dataset metadata, download the data from any data table on the portal, or even run SQL queries.
Click this link to get a JSON-formatted response with all dogs licensed in Allegheny County whose names start with "MR.".
We've done a workshop on using web APIs in general and the WPRDC's APIs in particular. The linked GitHub repository includes examples and documention on using our data API.
If you use Python or R, there are API wrappers that allow you to simplify the syntax needed to make API calls:
Some data API examples
Making SQL queries on WPRDC Data
- Jupyter notebook showing how to get and use WPRDC data in Python - Page down to the "Using SQL queries" section.
CKAN API usage under R + debugging a broken SQL query
- Using the CKAN API wrapper + converting string fields to integers in SQL queries - Addressing a common pitfall when running SQL queries, this R script shows how to convert a string field to an integer and then use it in the WHERE clause of a SQL query. This also gives a simple example of using the ckanr wrapper package to more easily use the CKAN API.
Tiny CKAN API examples
- How to build and run very simple datastore queries using Python - Again the "datastore" is a database that stores tables of data on the WPRDC data portal (like uploaded CSV files).