This Carpentry lesson introduces how to fetch data from APIs. At the conclusion of the lesson you will understand web data formats like JSON, how APIs function, and how to query APIs using the Command Line and python.
These lessons have been developed using instructional material from two primary carpentry lesson sources: -Joshua Dull, Sawyer Newman, & David Cirella. (2019, October). APIs for Libraries (Version v1.0). Zenodo. http://doi.org/10.5281/zenodo.3493358
This instructional material is made available under the Creative Commons Attribution license. The following is a human-readable summary of (and not a substitute for) the full legal text of the CC BY 4.0 license.
-Ed Bennett, Michele Mesiti, Colin Sauzé, “Introduction to the Web and Online APIs”
Setup | Download files required for the lesson | |
00:00 | 1. What is an API? |
What is an API?
Why do we need APIs? How APIs work? |
00:20 | 2. Web APIs |
How do Web APIs facilitate communication between software systems over the internet?
What role does HTTP play in Web API interactions? How are requests and responses structured to exchange data effectively? |
00:40 | 3. Data on the Web | How do I read data types like JSON & XML? |
00:55 | 4. Creating URL Queries |
What are API keys? How do we obtain an API key?
What are URL query strings? How do you interpret API documentation? How can you create an API query? |
01:35 | 5. API queries in python |
What python libraries can we use to make API requests?
How do we store and access API keys securely? How do we use the Python libraries to make an API request? |
01:55 | 6. API Queries in Shell |
How do I fetch data from API’s using the Unix shell?
How do I process API responses to get plain text, usable by standard Unix shell tools? |
03:05 | 7. Exercise: NCBI E-utilities | How can we use the Entrez Programming Utilities (E-utilities) to search across the Entrez Molecular Sequence Database System? |
03:05 | 8. Swagger Specification | What is the purpose of the Swagger specification in API development? |
03:05 | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.