What is it?
An HTTP method tells the server what type of action the client wants to perform.
Common methods include GET, POST, PUT, PATCH, and DELETE.
Simple Definition: A method tells the API what kind of action you want.
Software Knowledge → 03 · HTTP & APIs → Method
The part of an HTTP request that describes what action should be performed.
An HTTP method tells the server what type of action the client wants to perform.
Common methods include GET, POST, PUT, PATCH, and DELETE.
Simple Definition: A method tells the API what kind of action you want.
Think of an endpoint as a resource.
The method tells the system what you want to do with that resource.
Example:
Methods commonly describe actions such as:
HTTP methods are used in:
GET /api/ordersRetrieve orders.
POST /api/ordersCreate an order.
PATCH /api/orders/1001Update part of an order.
DELETE /api/orders/1001Delete an order.
The endpoint may stay similar while the method changes the requested action.
The method and endpoint work together to describe an API request.
Describes the requested action.
Identifies where the request should go.
| ENGLISH TERM | 中文 | SIMPLE ENGLISH | 中文小白理解 |
|---|---|---|---|
| Method | HTTP 方法 | The part of a request that describes the requested action. | 用来表示 HTTP 请求想执行什么操作的方法。 |
| GET | 获取 | Usually used to retrieve data. | 通常用于获取数据。 |
| POST | 创建 / 提交 | Usually used to create or submit data. | 通常用于创建或提交数据。 |
| PUT | 完整更新 | Usually used to replace a resource. | 通常用于完整替换一个资源。 |
| PATCH | 部分更新 | Usually used to update part of a resource. | 通常用于修改资源的一部分。 |
| DELETE | 删除 | Usually used to remove a resource. | 通常用于删除一个资源。 |
| Endpoint | 接口地址 | The address where an API operation is available. | API 中某项操作对应的访问地址。 |
| Request | 请求 | A message containing a method, endpoint, and other information. | 包含方法、接口地址和其他信息的请求。 |
| Resource | 资源 | Data or an object exposed through an API. | API 对外提供访问的数据或业务对象。 |
| REST API | REST API | An API style that commonly uses HTTP methods with resources. | 常通过 HTTP 方法操作资源的一种 API 设计方式。 |
An HTTP method describes an action.
The method works together with an endpoint.
GET, POST, PUT, PATCH, and DELETE are common API methods.