Skip to main content

REST-like

Versioning

The endpoint paths must start with the version of the API (e.g. v1/)

Endpoint Naming

Endpoints must be descriptive and in the plural form.
Endpoint names consisting out of multiple word kebab-case.
methode should bla bla [TODO!]

Good example:

  • [GET] v1/users/{user-id}
  • [POST] v1/users

User information belongs in the request body

Bad example:

  • [GET] /user/getName
  • [POST] /users-create?firstName=Max&lastName=Mustermann&Password=1234

HTTP methods

Allowed methods:

  • GET
  • PUT
  • POST
  • DELETE
  • PATCH

HTTP status codes

HTTP Cats
HTTP Status Ducks API - A duck image for every HTTP Status Code

Examples:

Most frequently used codes

What happened?Status Code
User data was retrieved200
A user was created201
Job was scheduled202
Endpoint excpected a userId but no userId was given400
No authorization was provided401
No permission for that endpoint403
Requested endpoint was not found404
Tried to create a user that already exists409
🫖 Teapot418
Server ran into error while processing the request500

Stateless Endpoints

The application bust be stateless meaning no information is stored about past requests. => same request must return the same response

Information Transfer

Payloads must be JSON.

Param TypePurposeExample
Path ParameterIdentifying ressource[GET] v1/users/123
Request BodyComplex, structured data (e.g., JSON payloads)[POST] v1/users
Query ParameterFilter / sort / paginate[GET] /users?role=admin