Statistics
Get statistical data for backend management system.
Interface Information
- Endpoint:
GET /api/admin/stats - Authentication: Required (admin permission)
- Content-Type:
application/json
Request Headers
| Parameter | Description |
|---|---|
| Authorization | Bearer Token |
Response Fields
| Field Name | Type | Description |
|---|---|---|
| articles | object | Article statistics |
| articles.total | number | Total articles |
| articles.published | number | Published count |
| articles.draft | number | Draft count |
| projects | object | Project statistics |
| projects.total | number | Total projects |
| projects.published | number | Published count |
| projects.draft | number | Draft count |
| views | object | Visit statistics |
| views.today | number | Today's visits |
| views.total | number | Total visits |
| likes | number | Total likes |
| messages | number | Total messages |
Request Example
bash
curl http://localhost:3000/api/admin/stats \
-H "Authorization: Bearer your-jwt-token"Response Example
json
{
"success": true,
"data": {
"articles": {
"total": 150,
"published": 120,
"draft": 30
},
"projects": {
"total": 25,
"published": 20,
"draft": 5
},
"views": {
"today": 128,
"total": 12500
},
"likes": 890,
"messages": 45
}
}Error Responses
| HTTP Status Code | Description |
|---|---|
| 401 | Not logged in or token invalid |
| 403 | Insufficient permission (non-admin) |
| 500 | Server error |