Glossary · Architecture
REST
Representational State Transfer
Also known as: rest api, restful, http api
An architectural style for web APIs where resources have URLs and clients act on them with standard HTTP methods such as GET, POST, PUT, and DELETE.
Methods at a glance
| Method | Use | Idempotent |
|---|---|---|
GET /orders/42 |
Read | Yes |
POST /orders |
Create | No |
PUT /orders/42 |
Replace | Yes |
PATCH /orders/42 |
Partial update | Not guaranteed |
DELETE /orders/42 |
Delete | Yes |
Try it
curl -s https://api.example.com/orders/42
curl -s -X POST https://api.example.com/orders \
-H 'Content-Type: application/json' -d '{"item":"book","qty":1}'
Habits that help
- Plural nouns for collections (
/orders), no verbs in paths. - Return proper status codes:
201on create,404when missing,422for validation errors. - Version the API (
/v1/...or a header) before the first breaking change.