REST (Representational State Transfer) is an architectural style for building APIs. A RESTful API uses HTTP methods as verbs and URLs as nouns.
| Method | Meaning | Example |
|---|---|---|
| GET | Fetch resource(s) | GET /posts |
| POST | Create a resource | POST /posts |
| PUT | Replace a resource | PUT /posts/1 |
| PATCH | Partial update | PATCH /posts/1 |
| DELETE | Remove a resource | DELETE /posts/1 |
Status codes
200 OK — successful GET or PUT
201 Created — successful POST
204 No Content — successful DELETE (no body)
400 Bad Request — client sent invalid data
401 Unauthorized — not authenticated
403 Forbidden — authenticated but not allowed
404 Not Found — resource doesn't exist
500 Server Error — unexpected server failureREST (Representational State Transfer) is an architectural style for building APIs. A RESTful API uses HTTP methods as verbs and URLs as nouns.
| Method | Meaning | Example |
|---|---|---|
| GET | Fetch resource(s) | GET /posts |
| POST | Create a resource | POST /posts |
| PUT | Replace a resource | PUT /posts/1 |
| PATCH | Partial update | PATCH /posts/1 |
| DELETE | Remove a resource | DELETE /posts/1 |
Status codes
200 OK — successful GET or PUT
201 Created — successful POST
204 No Content — successful DELETE (no body)
400 Bad Request — client sent invalid data
401 Unauthorized — not authenticated
403 Forbidden — authenticated but not allowed
404 Not Found — resource doesn't exist
500 Server Error — unexpected server failure