Designing an APIProLesson 33 of 45, about 9 min
- 1
- 2
- 3
- 4
- 5
- 6
- 7
The app: Courier, an HTTP client
CourierHarbor API · routesfrom your agent
Your agent wrote POST /api/getInvoices
Your agent wrote GET /api/deleteMember?id=5
Your agent wrote POST /api/createCharge
The raw HTTP, and what Harbor does with it
routes Harbor’s public API0 of 3 renamed
POST /api/getInvoices -- to rename
GET /api/deleteMember?id=5 -- to rename
POST /api/createCharge -- to rename
The rules
-- the path names a thing, in the plural: /v1/invoices
-- the method is the verb: GET reads, POST creates, DELETE removes
-- GET never changes anything: crawlers and previews follow it
The MagisterLeft: Courier, an HTTP client, open on Harbor’s public API. Your agent named routes after actions, like getInvoices. A REST API names things instead, and lets the method say what happens: GET reads, POST creates, DELETE removes. Pick the better route for each of the three.
Step 1 of 7Name the routes as resources
- A resource route for
POST /api/getInvoices - A resource route for
GET /api/deleteMember?id=5 - A resource route for
POST /api/createCharge
You’re not signed in, so this lesson won’t be saved to your path. Sign in free to keep your XP.