cheatsheets

API

Status Codes

Status Code Reason Phrase Description
200 OK The request was successfully received, understood, and accepted.
201 Created The request was successful and a resource was created.
204 No Content The request was successful, but there’s no representation to return (i.e. the response is empty).
400 Bad Request The request could not be understood or was missing required parameters.
401 Unauthorized Authentication failed or user does not have permissions for the desired action.
403 Forbidden Authentication succeeded, but the authenticated user does not have access to the requested resource.
404 Not Found The requested resource could not be found.
405 Method Not Allowed The method specified in the request is not allowed for the resource identified by the request URI.
409 Conflict The request could not be completed due to a conflict with the current state of the target resource.
500 Internal Server Error An error occurred on the server.
503 Service Unavailable The service is unavailable, often due to maintenance.

Naming Conventions

1. Use RESTful Resource Naming

2. Keep URLs Simple

3. Use HTTP Methods Consistently

4. Use Lowercase Letters

5. Avoid Using Query Parameters for CRUD

6. Use Hyphens (-) Instead of Underscores (_)

7. Be Clear with Endpoint Functionality

8. Version Your API

9. Use Conventional Status Codes

10. Keep Consistent Naming