APIs (Application Programming Interfaces)
An API (Application Programming Interface) is a set of rules and protocols that allow one application to interact with another. APIs are used to define how software components should interact and are essential for building modern applications. Most biology data portals expose REST APIs over HTTP that return JSON — the same JSON you can load into pandas.
We will be interacting with APIs in order to dynamically retrieve datasets from different sources.
Try it: GET a JSON dataset
UK Bank Holidays is a simple public JSON API with no key required:
Same request in Python (run inside your venv with pip install requests pandas):
| Python | |
|---|---|
Going further
Real biology APIs need the same pattern plus: an API key sent in a header (Authorization: Bearer ...), pagination (?page=... / ?limit=...), and rate limits (pause between calls). Always read the API docs for auth and usage limits, and never commit keys to git.
Verify it worked
You should see HTTP 200 OK, valid JSON, and a table with title / date columns. If you see 401/403, you need an API key. If you see 429, you hit a rate limit — wait and retry.
Public APIs
- UK Bank Holidays: https://www.gov.uk/bank-holidays.json
- Malaysia Central Bank Data: https://apikijangportal.bnm.gov.my/openapi
- A full list is available here: https://github.com/public-apis/public-apis