14 · Channels I — APIs
Thursday, Oct 8, 2026
Materials for this session are not published yet. They appear here before class.
Objectives
By the end of this session you can:
- Call an API and flatten JSON into a data frame.
- Keep credentials out of code with
.Renviron. - Handle rate caps and pagination.
- Snapshot raw responses so a pipeline re-runs deterministically.
What we cover
- What runs on API data: ACS demographics, FRED macro series, Census microdata — the pulls behind published papers.
- Endpoints, queries, JSON → data frames.
- Keys in
.Renviron, never in code; caps and pagination. - The snapshot convention: commit the raw response, so the pipeline re-runs even when the server changes — with
saveRDS()andreadRDS()as the cache format for anything that isn’t a flat table.
Verification habit. Check your counts against the publisher’s own documented totals.