Loading...
Loading...
Эксперт по API reference документации. Используй для создания справочников по API, описания endpoints и примеров запросов.
npx skill4agent add dengineproblem/agents-monorepo api-reference-guide# API Key Authentication
curl -X GET "https://api.example.com/v1/users" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"// JavaScript SDK Example
const client = new APIClient({
apiKey: 'your-api-key',
baseURL: 'https://api.example.com/v1'
});| Параметр | Тип | Место | Обязательный | Описание |
|---|---|---|---|---|
| id | string | path | да | Уникальный ID пользователя |
| include | string | query | нет | Связанные ресурсы через запятую |
curl -X GET "https://api.example.com/v1/users/12345?include=profile,settings" \
-H "Authorization: Bearer YOUR_API_KEY"{
"id": "12345",
"email": "user@example.com",
"created_at": "2023-01-15T10:30:00Z",
"profile": {
"first_name": "John",
"last_name": "Doe"
}
}{
"email": "string (обязательный)",
"password": "string (обязательный, минимум 8 символов)",
"profile": {
"first_name": "string (опциональный)",
"last_name": "string (опциональный)"
}
}{
"id": "12346",
"email": "newuser@example.com",
"created_at": "2024-01-15T14:30:00Z"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": [
{
"field": "email",
"message": "Email address is required"
}
],
"request_id": "req_1234567890"
}
}| Код | Статус | Описание |
|---|---|---|
| 200 | OK | Успешный запрос |
| 201 | Created | Ресурс создан |
| 400 | Bad Request | Ошибки валидации |
| 401 | Unauthorized | Неверный/отсутствующий токен |
| 403 | Forbidden | Недостаточно прав |
| 404 | Not Found | Ресурс не найден |
| 429 | Too Many Requests | Превышен лимит запросов |
| 500 | Internal Server Error | Ошибка сервера |
import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
response = requests.get(
'https://api.example.com/v1/users/12345',
headers=headers
)
print(response.json())const fetch = require('node-fetch');
const response = await fetch('https://api.example.com/v1/users/12345', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);req, _ := http.NewRequest("GET", "https://api.example.com/v1/users/12345", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()User:
type: object
properties:
id:
type: string
description: Unique user identifier
example: "usr_1234567890"
email:
type: string
format: email
description: User's email address
created_at:
type: string
format: date-time
description: ISO 8601 timestamp
status:
type: string
enum: [active, inactive, suspended]
description: Current account statusGET /users?filter[status]=active&filter[role]=adminGET /users?page=2&limit=20
Response headers:
X-Total-Count: 150
X-Page: 2
X-Per-Page: 20
Link: <https://api.example.com/v1/users?page=3>; rel="next"GET /users?sort=-created_at,emailGET /users?fields=id,email,created_atcurl -X POST "https://api.example.com/v1/payments" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: unique-request-id-123" \
-d '{"amount": 1000}'X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200