Digital Frameworks

Web APIs and query languages

Use Postman (a utility for making structured HTTP requests) with the Socrata API (a web API) and the Socrata Query Langauge (a query language) to get summarized data.

Overview

Tools: Socrata (city of Chicago open data portal version), Socrata Query Language (SoQL), Postman (a web browser-like tool for interacting with web APIs).

Concepts: Application programming interfaces (API), structured queries (select, filter, grouping, and aggregation), the request-response cycle.

Philosophy: Learning how to know what you need to learn next, how to understand enough to do what you need to do.

Assignment

Read In Defense of Interactive Graphics.

Find a dataset on a Socrata open data portal. This list of portals will be crucial.

The dataset should include a time-based field and, if possible, a categorical field or two.

Run at least two queries using the Socrata Open Data API and the Socrata Query Language using Postman. Your queries should include at least two of these parameters:

  • A $select clause to pick the columns you wish to include in the exported data
  • A $groupby clause to aggregate by a time or categorical field
  • A $where clause to filter the data

You might want to use an $order clause to get more usable output, but you can also do this in your spreadsheet tool.

Import the datasets you downloaded into a Google Sheets spreadsheet and write a short blog post or create a short video describing what you found like you did for lesson 2. Link to both your spreadsheet and your original API queries at the end of your post.

With any luck, you’ll be equipped with a strong and useful dataset to visualize next week.

Lesson

The NICAR Hitchhiker’s Guide to Web APIs by David Eads.

Copyright © 2017, David Eads. This lesson is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Created by David Eads and the students of Medill Digital Frameworks. Copyright varies by page and author.