🔌REST Resource
Also known as Resource (REST), API Resource, Resource URI
One thing a REST API offers, like an order. It has its own address.
Think of it like
Think of it like a drawer with a name on it. Each drawer holds one kind of thing.
Example
Jack's API has /orders for all orders and /orders/42 for one. To cancel order 42, he sends DELETE to /orders/42.
Why it matters
Clear resources make an API easy to guess. Users can work out new endpoints alone.
Definition
Example code
http
GET /orders/42 HTTP/1.1
Host: api.example.comCommon mistake
Key takeaways
- 1Nouns. Name things, not actions.
- 2One address each. Like /orders/42.
- 3Methods act. GET, POST, PUT, PATCH, DELETE.