Lesson 5 of 7
Lesson 5 — APIs and Webhooks
Make your workflows talk to other systems: request data, send data and react to events in real time.
Learn it
An API is a set of rules that lets one program ask another for data or ask it to do something.
The most common API style is REST, which uses URLs and HTTP methods: GET to read, POST to create, PUT/PATCH to update, DELETE to remove.
A webhook is the opposite of polling. Instead of asking 'any news?' every minute, the other system sends you data as soon as something happens.
APIs usually need authentication, often with a token or key, so only authorised users can use them.
Key terms
- API
- Application Programming Interface — rules for how programs communicate.
- REST
- An API style using URLs and HTTP methods.
- Webhook
- A push notification from one system to another via HTTP.
- JSON
- A lightweight data format used by most APIs.
- Rate limit
- A cap on how many API calls are allowed in a period.
A weather alert webhook
A weather service sends a webhook when a storm warning is issued.
- 1Webhook fires: POST to your URL with warning details in JSON.
- 2Parse: Extract location, severity and expiry time.
- 3Condition: Is severity 'severe'? If yes, alert all staff.
- 4Action: Post to Slack/Teams and log to a spreadsheet.
A simple GET request in Python
pythonimport requests
response = requests.get('https://api.example.com/weather/Prague')
print(response.status_code)
data = response.json()
print(data['temperature'])
print(data['forecast'])The script asks the API for Prague weather, checks the status code, then reads the JSON fields it needs.
Try it
Match HTTP method to meaning.
Challenge
Design an API/webhook flow for a school: when a student swipes their ID card at the gate, a webhook sends student_id and timestamp. Your flow should mark them present in a database and email the parent if the swipe is after 09:00. List the HTTP method, endpoint, condition and actions.
Pick whichever way suits you — every mode earns the same bonus XP.
Write at least 40 more characters to submit.
Mark your own work
Guided walkthrough — 0/3 clues revealed
- Clue 1 locked — reveal it only if you get stuck.
- Clue 2 locked — reveal it only if you get stuck.
- Clue 3 locked — reveal it only if you get stuck.
Each clue costs 4 XP (never below 20 XP). You'd earn 40 XP right now.