Common HTTP Methods

By Łukasz Kallas
Picture of the author
Published on
programming image

HTTP methods, also known as HTTP verbs, define the action to be performed on a given resource.

Common HTTP Methods

  1. GET

The GET method is used to retrieve data from a server. It is a read-only request that does not alter the state of the resource.

  • Use Case: Fetching data from an API, such as retrieving user details or a list of products.
  • Idempotent: Yes (multiple identical requests have the same effect as a single request).
  1. POST

The POST method is used to send data to a server to create a new resource. It often involves submitting form data or uploading a file.

  • Use Case: Creating a new user account or posting a comment.
  • Idempotent: No (repeated requests can result in multiple resource creations).
  1. PUT

The PUT method is used to update an existing resource or create a new resource if it does not exist. It replaces the entire resource with the new data provided.

  • Use Case: Updating user information or replacing a document.
  • Idempotent: Yes (multiple identical requests result in the same state).
  1. DELETE

The DELETE method is used to remove a resource from the server.

  • Use Case: Deleting a user account or removing an item from a database.
  • Idempotent: Yes (multiple identical requests have the same effect as a single request).
  1. PATCH

The PATCH method is used to apply partial modifications to a resource. Unlike PUT, it only updates the specified fields rather than replacing the entire resource.

  • Use Case: Updating specific fields of a user profile, such as changing the email address.
  • Idempotent: Yes (multiple identical requests result in the same state).

Stay Tuned

Want to learn?
The best articles, links and news related to software development delivered once a week to your inbox.