Method | Description |
---|---|
GET |
Used to retrieve a single item or a collection of items. |
POST |
Used when creating new items e.g. a new user, post, comment, etc. |
PATCH |
Used to update one or more fields on an item e.g. update e-mail of user. |
PUT |
Used to replace a whole item (all fields) with new data. |
DELETE |
Used to delete an item. |
Code | Title | Description |
---|---|---|
200 |
OK |
When a request was successfully processed (e.g. when using GET , PATCH , PUT or DELETE ). |
201 |
Created |
Every time a record has been added to the database (e.g. when creating a new user or post). |
304 |
Not modified |
When returning a cached response. |
400 |
Bad request |
When the request could not be understood (e.g. invalid syntax). |
401 |
Unauthorized |
When authentication failed. |
403 |
Forbidden |
When an authenticated user is trying to perform an action, which he/she does not have permission to. |
404 |
Not found |
When URL or entity is not found. |
440 |
No accept header |
When the required "Accept" header is missing from the request. |
422 |
Unprocessable entity |
Whenever there is something wrong with the request (e.g. missing parameters, validation errors) even though the syntax is correct (i.e., 400 is not warranted). |
500 |
Internal server error |
When an internal error has happened (e.g. when trying to add/update records in the database fails). |
502 |
Bad Gateway |
When a necessary third-party service is down. |
- : The endpoint is currently working.
- : The endpoint is experiencing issues or is not available.
- : The endpoint is currently under maintenance.
- : The endpoint is in testing and may not be stable.
- : The endpoint is in an experimental phase and subject to change.
Method | URL | Description | Status | Navigation |
---|---|---|---|---|
GET |
/api/posts |
Retrieve all posts. | Get me there! |
-
- Method:
GET
- URL:
/api/posts
- Description: Retrieve all posts.
{ "id": 123, "title": "Sample Post", "content": "This is the content of the post.", "author": { "id": 456, "name": "John Doe" }, "created_at": "2023-01-01T12:34:56Z", "updated_at": "2023-01-02T08:45:12Z" }
- Method: