This is an API tutorial for a workshop at "Code for DC's National Day of Civic Hacking"
- Application Programming Interface
- “set of routines, protocols, and tools for building software and applications” [Wikipedia]
- Usually used when someone makes an app that uses data
- Access:
- Databases (comment sections on websites, open government data)
- streaming data (e.g uber, twitter)
 
- One .keynotewith some basic API info and a resources slide
- Two .pyfiles:- API_code.pycontains code to grab data from the 30-day crime API
- scheduled_API_code.pycontains code to schedule grabing of the data so you can collect multiple times at regular intervals (eg when running on a server): - Data is appended to a csv, - Duplicates are removed, - Scheduling is (currently, but you can change it) once every ~29 days
 
- One .ipynbfile that steps through the process more clearly (hopefully)- the code is a little different from API_code.pybut essentally does the same thing
 
- the code is a little different from 
- One .geojsonfile as an example of API output
- Two .csv.example output files. They are slightly different:- spyder_foo.csvis an output when running the- scheduled_API_code.pyfrom my Spyder IDE
- ipython_foo.csvis the output when running the- ipython notebookcode.
 
- Read more about APIs on this Techcrunch post
Tutorials
- Codecademy tutorials
- Automating the boring stuff Scroll down to JSON and APIs section: Tips
 
- How to read response codes
- Always check the Terms of Use / Terms of Service
APIs you could play with