Loading...
Loading...
Compare original and translation side by side
/users/orders/products/users/{id}/orders/user-profiles/userProfiles/users/{id}/activatePOST /users/{id}/activation/users/orders/products/users/{id}/orders/user-profiles/userProfiles/users/{id}/activatePOST /users/{id}/activation| Method | Purpose | Idempotent | Request Body | Success Code |
|---|---|---|---|---|
| GET | Read resource(s) | Yes | No | 200 |
| POST | Create resource | No | Yes | 201 |
| PUT | Full replace | Yes | Yes | 200 |
| PATCH | Partial update | No | Yes | 200 |
| DELETE | Remove resource | Yes | No | 204 |
Location| 方法 | 用途 | 幂等性 | 请求体 | 成功状态码 |
|---|---|---|---|---|
| GET | 读取资源(一个或多个) | 是 | 无 | 200 |
| POST | 创建资源 | 否 | 有 | 201 |
| PUT | 完全替换资源 | 是 | 有 | 200 |
| PATCH | 部分更新 | 否 | 有 | 200 |
| DELETE | 删除资源 | 是 | 无 | 204 |
Location200 OK - Successful read/update
201 Created - Successful creation
204 No Content - Successful delete
400 Bad Request - Validation error (include field-level errors)
401 Unauthorized - Missing or invalid authentication
403 Forbidden - Authenticated but not authorized
404 Not Found - Resource does not exist
409 Conflict - State conflict (duplicate, version mismatch)
422 Unprocessable - Semantically invalid (valid JSON, bad values)
429 Too Many Reqs - Rate limited (include Retry-After header)
500 Internal Error - Unhandled server error (never expose stack traces)200 OK - 读取/更新成功
201 Created - 创建成功
204 No Content - 删除成功
400 Bad Request - 验证错误(包含字段级错误)
401 Unauthorized - 缺少或无效的身份认证
403 Forbidden - 已认证但无权限
404 Not Found - 资源不存在
409 Conflict - 状态冲突(重复、版本不匹配)
422 Unprocessable - 语义无效(JSON格式合法,但值不合法)
429 Too Many Reqs - 请求超限(包含Retry-After头)
500 Internal Error - 未处理的服务器错误(绝不要暴露堆栈跟踪){
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{ "field": "email", "message": "Must be a valid email address" },
{ "field": "age", "message": "Must be at least 18" }
]
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{ "field": "email", "message": "Must be a valid email address" },
{ "field": "age", "message": "Must be at least 18" }
]
}
}GET /users?limit=20&cursor=eyJpZCI6MTAwfQ
Response:
{
"data": [...],
"pagination": {
"next_cursor": "eyJpZCI6MTIwfQ",
"has_more": true
}
}GET /users?limit=20&cursor=eyJpZCI6MTAwfQ
Response:
{
"data": [...],
"pagination": {
"next_cursor": "eyJpZCI6MTIwfQ",
"has_more": true
}
}GET /users?page=3&per_page=20
Response:
{
"data": [...],
"pagination": {
"page": 3,
"per_page": 20,
"total": 245,
"total_pages": 13
}
}GET /users?page=3&per_page=20
Response:
{
"data": [...],
"pagination": {
"page": 3,
"per_page": 20,
"total": 245,
"total_pages": 13
}
}GET /orders?status=pending&created_after=2025-01-01&sort=-created_at,+total
GET /products?category=electronics&price_min=100&price_max=500
GET /users?search=john&fields=id,name,emailfields-GET /orders?status=pending&created_after=2025-01-01&sort=-created_at,+total
GET /products?category=electronics&price_min=100&price_max=500
GET /users?search=john&fields=id,name,emailfields-/api/v1/users
/api/v2/usersSunset/api/v1/users
/api/v2/usersSunsetContent-Type: application/json
Accept: application/json
Authorization: Bearer <token>
X-Request-Id: <uuid> # For tracing
X-RateLimit-Limit: 100 # Requests per window
X-RateLimit-Remaining: 47 # Remaining in window
X-RateLimit-Reset: 1700000000 # Window reset Unix timestamp
Retry-After: 30 # Seconds until rate limit resetsX-Request-IdContent-Type: application/json
Accept: application/json
Authorization: Bearer <token>
X-Request-Id: <uuid> # 用于追踪
X-RateLimit-Limit: 100 # 窗口期内最大请求数
X-RateLimit-Remaining: 47 # 窗口期内剩余请求数
X-RateLimit-Reset: 1700000000 # 窗口期重置的Unix时间戳
Retry-After: 30 # 限流重置前的等待秒数X-Request-Id$ref$ref: '#/components/schemas/User'examplesoneOfanyOfpaths:
/users/{id}:
get:
operationId: getUser
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: User found
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
$ref: '#/components/responses/NotFound'$ref$ref: '#/components/schemas/User'examplesoneOfanyOfpaths:
/users/{id}:
get:
operationId: getUser
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: User found
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
$ref: '#/components/responses/NotFound'429Retry-After429Retry-After