PART III · HTTP & APIs

REST API

A common way to design APIs around resources and HTTP methods.

01 · What is it?

A REST API is a common style for designing web APIs.

It usually represents business data as resources and uses HTTP methods to perform actions on those resources.

Simple Definition:
A REST API organizes API operations around resources.

02 · Think of it like...

Think of an API resource as a collection of business objects.

Orders

Customers

Products

Each resource has an address and common actions.

OrdersA collection of business objects
Common actions
  • Get Orders
  • Create Order
  • Update Order
  • Delete Order

03 · What does it do?

A REST API commonly uses these HTTP methods to work with resources.

GETRetrieve
POSTCreate
PUTReplace
PATCHPartially update
DELETERemove

04 · Where is it used?

REST APIs are commonly used in:

Web Applications
Mobile Applications
Business Systems
Cloud Services
System Integrations

05 · Example

GET /api/orders

Retrieve orders.

GET /api/orders/1001

Retrieve one order.

POST /api/orders

Create an order.

PATCH /api/orders/1001

Update part of an order.

DELETE /api/orders/1001

Delete an order.

These examples show the design pattern. They are not implementation code.

06 · How it connects

Resource→Endpoint→HTTP Method→Backend Action
Orders→/api/orders→POST→Create Order

REST APIs combine resource-oriented URLs with HTTP methods.

07 · Do Not Confuse

API

The broader concept of a software interface.

REST API

One common way to design a web API.

REST is an API design style.
Not every API is REST.

08 · Topic Glossary

English Term中文Simple English中文小白理解
REST APIREST APIA common way to design web APIs around resources.一种以资源为中心设计 Web API 的常见方式。
Resource资源A business object or data exposed through an API.API 中可以被访问和操作的数据或业务对象。
Endpoint接口地址A specific URL used to access a resource.用来访问某个 API 资源的具体地址。
GET获取Usually used to retrieve a resource.通常用于获取资源数据。
POST创建 / 提交Usually used to create a new resource.通常用于创建新的资源。
PUT完整更新Usually used to replace a resource.通常用于完整替换一个资源。
PATCH部分更新Usually used to change part of a resource.通常用于修改资源的一部分。
DELETE删除Usually used to remove a resource.通常用于删除一个资源。
HTTPHTTP 协议The protocol commonly used by REST APIs.REST API 常用的基础通信协议。
JSONJSON 数据格式A common format for REST API data.REST API 常用的数据交换格式。

09 · What to Remember

REST API is one common API design style.

REST APIs organize operations around resources.

HTTP methods describe what action should be performed.

Final:
Resource + Endpoint + HTTP Method = REST API Operation

↑