MWZ

MINDWAREZONE

HTTP Methods

Answer

Clear, interview-ready explanation

HTTP methods express the intended action on a resource.

Common methods

  • GET: retrieve a representation without intending to change server state.
  • POST: submit data for processing, commonly to create a resource.
  • PUT: generally replace the target resource representation.
  • PATCH: apply partial modifications.
  • DELETE: request removal of the target resource.

Idempotency

  • An operation is idempotent if repeating the same request has the same intended effect on server state as doing it once.
  • GET, PUT, and DELETE are defined as idempotent, although response codes may differ.
  • POST is not inherently idempotent. Use idempotency keys for operations such as payment creation when duplicate effects must be avoided