Skip to content

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

ParameterDescription
AuthorizationBearer Token

Response Fields

Field NameTypeDescription
articlesobjectArticle statistics
articles.totalnumberTotal articles
articles.publishednumberPublished count
articles.draftnumberDraft count
projectsobjectProject statistics
projects.totalnumberTotal projects
projects.publishednumberPublished count
projects.draftnumberDraft count
viewsobjectVisit statistics
views.todaynumberToday's visits
views.totalnumberTotal visits
likesnumberTotal likes
messagesnumberTotal 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 CodeDescription
401Not logged in or token invalid
403Insufficient permission (non-admin)
500Server error