Skip to content

REST API

一句话解释

REST API 是方式的 设计 web APIs 哪里 resources 是 accessed 通过标准 HTTP 方法 on URLs.

用大白话说

REST (Representational State Transfer) is the most common architectural style for web APIs. In a REST API, resources (like users, posts, products) are identified by URLs, and you interact with them using standard HTTP methods.

The four basic operations map to CRUD: GET (read/retrieve), POST (create), PUT (replace/update), DELETE (remove). For example, GET /用户/42 retrieves user 42, POST /用户 creates a new user, PUT /用户/42 updates user 42, and DELETE /用户/42 removes user 42.

REST APIs are stateless — each request contains all the information needed, and the server does not store client state between requests. They typically return JSON. REST is simple, widely understood, and works well with HTTP, making it the default choice for most web APIs.

示例

http
GET    /users        → List all users
POST   /users        → Create a new user
GET    /users/42     → Get user 42
PUT    /users/42     → Update user 42
DELETE /users/42     → Delete user 42

标准 REST URL 模式 for CRUD 操作 on 用户 resource.

相关术语

相关资源

相关课程

  • API

    学习关于 APIs.

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表