DEV Community


HTTP Explained

mmartinezsoria profile image Maximo Martinez Soria ・1 min read

HTTP stands for Hyper Text Transfer Protocol and is the one that specifies the rules on the communication between two computers through internet.


The verbs are actions that define what are we about to do in each request.

  • GET: fetch data.
  • HEAD: get headers. It's like a GET request but without content.
  • POST: create information.
  • PUT / PATCH: update information.
  • DELETE: delete information.

Verbs, allow us to have different responses for only one endpoint.

We could create lot's of endpoints for a resource or we can just use the main word and use the verbs.

For example:

  • GET /books
  • POST /books
  • DELETE /books

It's better than:

  • GET /get-all-books
  • POST /create-a-book
  • DELETE /delete-book


Every request it's going to return a code status. Let's see which codes exists and why.

  • 1xx: pending. Anything happens yet.
  • 2xx: success.
  • 3xx: usually a redirect.
  • 4xx: client-side errors.
  • 5xx: server-side errors.

Common codes status

  • 200: everything is ok. Usually used in GET request.
  • 201: everything is ok. Usually used in POST / PUT request.
  • 204: usually used to say that a DELETE request was completed successfully. The resource was deleted.
  • 400: bad request. Something is wrong in the request.
  • 401: unauthorised. You need to specify credentials first.
  • 403: forbidden. You don't have permissions over that resource even though you are authenticated.
  • 404: not found. Resource doesn't exist.
  • 500: internal server error. The request couldn't be processed.

Is there another code status that you frequently use? Comment down below 😊


Editor guide