HTTP Method

HTTP Method

An HTTP method is a keyword in an HTTP request that tells a server what action the client wants to perform on a resource.

HTTP methods are fundamental to web communication and APIs because they help distinguish between actions such as retrieving data, creating records, updating information, or deleting resources.

Also known as: HTTP request method, HTTP verb.

How Does an HTTP Method Work?

An HTTP request usually begins with a method followed by a target path.

For example:

GET /products HTTP/1.1

In this request:

Method: GET
Resource: /products

The server interprets the method and decides how to process the request.

A simplified flow looks like this:

Client
  ↓
HTTP Method + Resource
  ↓
Server
  ↓
Process Requested Action
  ↓
HTTP Response

Common HTTP Methods

The most widely used HTTP methods include:

GET
POST
PUT
PATCH
DELETE
HEAD
OPTIONS

Each method has a different purpose.

GET

The GET method retrieves a resource or collection of resources.

For example:

GET /products HTTP/1.1

A server may return a list of products.

GET is commonly used for:

  • Loading webpages
  • Retrieving API data
  • Downloading resources
  • Reading records

A GET request should normally retrieve data without changing the underlying resource.

POST

The POST method sends data to the server and is commonly used to create a new resource or trigger an action.

For example:

POST /products HTTP/1.1
Content-Type: application/json

with a body such as:

{
  "name": "Wireless Mouse",
  "price": 29.99
}

The server may create a new product record.

POST is commonly used for:

  • Creating records
  • Submitting forms
  • Uploading data
  • Triggering server-side actions

PUT

The PUT method is generally used to create or replace the representation of a resource at a known location.

For example:

PUT /products/1001 HTTP/1.1

with:

{
  "name": "Wireless Mouse",
  "price": 34.99,
  "currency": "USD"
}

In many API designs, PUT represents a complete replacement of the resource.

PATCH

The PATCH method applies a partial update.

For example:

PATCH /products/1001 HTTP/1.1

with:

{
  "price": 34.99
}

Only the specified field may be updated.

In simple terms:

  • PUT: Commonly replaces the full resource representation.
  • PATCH: Changes selected fields.

DELETE

The DELETE method requests removal of a resource.

For example:

DELETE /products/1001 HTTP/1.1

The server may delete the product or mark it as removed depending on the application's design.

HEAD

The HEAD method is similar to GET, but the response does not include the normal message body.

For example:

HEAD /products/1001 HTTP/1.1

The server may return headers such as:

Content-Type
Content-Length
Last-Modified
ETag

without returning the complete resource content.

HEAD can be useful for checking resource metadata or availability.

OPTIONS

The OPTIONS method asks a server which communication options are supported for a resource.

For example:

OPTIONS /products HTTP/1.1

A response may indicate supported methods such as:

GET
POST
OPTIONS

OPTIONS is also commonly involved in cross-origin web communication.

HTTP Method vs. HTTP Status Code

An HTTP method describes what the client wants to do.

An HTTP status code describes the result returned by the server.

For example:

GET

is a request method, while:

200 OK

is a response status.

In simple terms:

  • HTTP Method: Requested action.
  • HTTP Status Code: Result of the request.

HTTP Method vs. Endpoint

An endpoint identifies where a request is sent.

The HTTP method identifies what action should be performed there.

For example:

Method:
GET

Endpoint:
/products/1001

may retrieve a product.

Using the same endpoint with:

Method:
DELETE

may request deletion of that product.

In simple terms:

  • Endpoint: Where the request goes.
  • HTTP Method: What the request asks the server to do.

Safe HTTP Methods

A safe method is intended only to retrieve information without changing server state.

Common safe methods include:

GET
HEAD
OPTIONS

A request using one of these methods should generally not create, modify, or delete application data.

Idempotent HTTP Methods

An HTTP method is idempotent when sending the same request multiple times is intended to have the same effect as sending it once.

Commonly idempotent methods include:

GET
PUT
DELETE
HEAD
OPTIONS

For example, deleting the same resource multiple times should not produce multiple separate deletions.

POST is generally not considered idempotent because repeating the same request may create multiple resources or trigger the same action more than once.

HTTP Methods and REST APIs

REST-style APIs commonly map HTTP methods to resource operations.

A typical pattern looks like:

GET    /products       Retrieve products
GET    /products/1001  Retrieve one product
POST   /products       Create a product
PUT    /products/1001  Replace a product
PATCH  /products/1001  Update part of a product
DELETE /products/1001  Delete a product

This makes API behavior easier to understand because each method has a conventional meaning.

HTTP Methods and Request Bodies

Some methods commonly include a request body.

For example:

POST
PUT
PATCH

often send structured data such as JSON.

Example:

{
  "name": "Mechanical Keyboard",
  "price": 89.99
}

Methods such as GET usually rely on the URL, query parameters, and headers rather than a request body.

HTTP Methods and Web Forms

HTML forms commonly use methods to control how submitted data is sent.

The most common form methods are:

GET
POST

A GET form may place submitted values into the query string.

A POST form typically sends the values in the request body.

HTTP Methods and Proxies

A proxy forwards HTTP requests and therefore sees the request method as part of the traffic.

For example:

Client
  ↓
POST /api/orders
  ↓
Proxy
  ↓
Destination Server

Depending on its configuration, a proxy may log, filter, route, or apply policies based on the request method.

However, the underlying meaning of the method is still defined by HTTP and the destination application's behavior.

HTTP Methods and Web Data Collection

HTTP methods are important in web data workflows because different resources require different types of requests.

For example:

GET
Retrieve a public page or API resource

POST
Submit an authorized API query or form

HEAD
Check whether a resource exists

OPTIONS
Inspect supported request behavior

Most basic web scraping uses GET, while API integrations may use several methods depending on the operation.

Example

Suppose an API manages product records.

To retrieve a product:

GET /products/1001 HTTP/1.1

To create a new product:

POST /products HTTP/1.1
Content-Type: application/json

with:

{
  "name": "Wireless Mouse",
  "price": 29.99
}

To change only the price:

PATCH /products/1001 HTTP/1.1
Content-Type: application/json

with:

{
  "price": 34.99
}

To remove the product:

DELETE /products/1001 HTTP/1.1

The endpoint identifies the resource, while the HTTP method defines the requested action.

Key Takeaway

An HTTP method is the part of an HTTP request that tells a server what action the client wants to perform.

Methods such as GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS are used throughout websites and APIs to retrieve, create, update, delete, and inspect resources. Understanding HTTP methods is essential for working with web applications, APIs, proxies, and data collection systems.

Join SwiftProxy Discord community Chat with SwiftProxy support via WhatsApp Chat with SwiftProxy support via Telegram
Chat with SwiftProxy support via Email