跳到主要内容
Skip to content

Access Methods

API docs are auto-generated by FastAPI in two formats:

FormatLocalOnline
Swagger UIhttp://127.0.0.1:8001/docshttps://service.fastapiadmin.com/api/v1/docs
Redochttp://127.0.0.1:8001/redochttps://service.fastapiadmin.com/api/v1/redoc

Usage

  1. Open Swagger UI, click Authorize (top right)
  2. Enter username and password
  3. Find endpoint → Try it out → fill params → Execute

API Categories

  • System Management: Users, roles, menus, departments, positions
  • Monitoring: Online users, server, cache
  • Task Management: Scheduled tasks
  • Log Management: Operation logs
  • Development Tools: Code generation, form builder

Response Format

All APIs use a unified format:

json
{
  "code": 200,
  "message": "success",
  "data": {}
}

Pagination

json
{
  "code": 200,
  "message": "success",
  "data": {
    "items": [],
    "total": 100,
    "page": 1,
    "pageSize": 10
  }
}

Frontend API Usage

Web

API modules under frontend/web/src/api/:

typescript
import { authApi } from '@/api/module_system/auth'

const login = async (username: string, password: string) => {
  const res = await authApi.login({ username, password })
  // Save token, fetch user info, redirect
}

Mobile

API modules under frontend/app/src/api/:

typescript
import { authApi } from '@/api/auth'

const login = async (username: string, password: string) => {
  const res = await authApi.login({ username, password })
  userStore.setToken(res.data.token)
  uni.switchTab({ url: '/pages/index/index' })
}

API Design Standards

StandardDescription
URLLowercase + underscore, plural resources, version in prefix
GETRetrieve resource
POSTCreate resource
PUTUpdate resource
DELETEDelete resource

FAQ

IssueSolution
401 Auth failureCheck login state, re-login
403 Insufficient permissionContact admin for permissions
422 Parameter errorVerify request parameters
500 Server errorCheck backend logs