# 400 错误请求：缺少必需的查询参数 'limit'

- **ID:** `api/http-400-missing-required-query-parameter`
- **领域:** api
- **类别:** request_error
- **验证级别:** ai_generated
- **修复率:** 95%

## 根因

API 端点需要特定的查询参数，但请求 URL 中未包含该参数。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| REST API v1 | active | — | — |
| OpenAPI 3.0 | active | — | — |
| FastAPI 0.100+ | active | — | — |
| Django REST Framework 3.14 | active | — | — |

## 解决方案

1. ```
   Add the missing query parameter to the URL. For example, change /api/items to /api/items?limit=10. In JavaScript: fetch('/api/items?limit=' + limit). In Python requests: requests.get('/api/items', params={'limit': 10})
   ```
2. ```
   Check the API documentation for all required parameters. Use a tool like Postman or curl to test the endpoint: curl -X GET 'https://api.example.com/items?limit=10'
   ```
3. ```
   If using an SDK, verify that the function call includes all required arguments. In some SDKs, the parameter may be optional with a default; check the method signature.
   ```

## 无效尝试

- **** — The server parses query parameters from the URL, not headers. (90% 失败率)
- **** — GET requests typically do not have a body; the server expects the parameter in the URL. (95% 失败率)
- **** — Parameter names are case-sensitive and must match exactly. (85% 失败率)
