curl -X POST http://localhost:8080/api/v2/core/auth/login \
-H "Content-Type: application/json" \
-d '{
"name": "admin",
"password": "your_password",
"language": "en"
}'Response:
{
"code": 200,
"data": {
"name": "admin",
"token": "session_token",
"mfaStatus": "disable",
"role": "admin"
}
}curl -X POST http://localhost:8080/api/v2/core/users \
-H "Content-Type: application/json" \
-H "Cookie: SESSIONID=your_token" \
-d '{
"username": "john_doe",
"email": "john@example.com",
"password": "secure_password_123",
"role": "reseller",
"realName": "John Doe",
"phone": "+1234567890",
"remark": "Reseller account"
}'curl -X GET "http://localhost:8080/api/v2/core/users?pageNum=1&pageSize=10&role=reseller" \
-H "Cookie: SESSIONID=your_token"Response:
{
"code": 200,
"data": {
"total": 5,
"items": [
{
"id": 1,
"username": "admin",
"email": "admin@example.com",
"role": "admin",
"status": "active",
"realName": "Administrator",
"phone": "",
"lastLogin": 1715000000,
"remark": "",
"createdAt": 1714900000,
"updatedAt": 1714950000
},
{
"id": 2,
"username": "john_doe",
"email": "john@example.com",
"role": "reseller",
"status": "active",
"realName": "John Doe",
"phone": "+1234567890",
"lastLogin": 1714990000,
"remark": "Reseller account",
"createdAt": 1714900100,
"updatedAt": 1714950100
}
]
}
}curl -X GET http://localhost:8080/api/v2/core/users/2 \
-H "Cookie: SESSIONID=your_token"Response:
{
"code": 200,
"data": {
"user": {
"id": 2,
"username": "john_doe",
"email": "john@example.com",
"role": "reseller",
"status": "active",
"realName": "John Doe",
"phone": "+1234567890",
"lastLogin": 1714990000,
"remark": "Reseller account",
"createdAt": 1714900100,
"updatedAt": 1714950100
},
"permissions": [
"user:view",
"user:create",
"user:update",
"user:delete",
"host:view",
"host:monitor",
"app:manage",
"app:create",
"database:manage"
]
}
}curl -X PUT http://localhost:8080/api/v2/core/users \
-H "Content-Type: application/json" \
-H "Cookie: SESSIONID=your_token" \
-d '{
"id": 2,
"email": "newemail@example.com",
"role": "user",
"status": "active",
"realName": "John Doe Updated",
"phone": "+9876543210",
"remark": "Updated reseller account"
}'curl -X DELETE http://localhost:8080/api/v2/core/users/2 \
-H "Cookie: SESSIONID=your_token"curl -X POST http://localhost:8080/api/v2/core/users/password/change \
-H "Content-Type: application/json" \
-H "Cookie: SESSIONID=your_token" \
-d '{
"userId": 2,
"oldPassword": "old_password_123",
"newPassword": "new_password_456"
}'curl -X POST http://localhost:8080/api/v2/core/users/password/reset \
-H "Content-Type: application/json" \
-H "Cookie: SESSIONID=admin_token" \
-d '{
"userId": 2,
"newPassword": "temporary_password_789"
}'curl -X GET http://localhost:8080/api/v2/core/users/2/permissions \
-H "Cookie: SESSIONID=your_token"Response:
{
"code": 200,
"data": [
"user:view",
"user:create",
"user:update",
"user:delete",
"host:view",
"host:monitor",
"host:manage",
"app:manage",
"app:create",
"app:update",
"app:delete",
"app:view",
"app:install",
"app:uninstall"
]
}curl -X POST http://localhost:8080/api/v2/core/users/permissions \
-H "Content-Type: application/json" \
-H "Cookie: SESSIONID=admin_token" \
-d '{
"userId": 2,
"permissions": [
"user:view",
"app:view",
"app:install",
"database:view",
"host:monitor"
]
}'curl -X GET http://localhost:8080/api/v2/core/users/profile \
-H "Cookie: SESSIONID=your_token"Response:
{
"code": 200,
"data": {
"user": {
"id": 2,
"username": "john_doe",
"email": "john@example.com",
"role": "reseller",
"status": "active",
"realName": "John Doe",
"phone": "+1234567890",
"lastLogin": 1714990000,
"remark": "Reseller account",
"createdAt": 1714900100,
"updatedAt": 1714950100
},
"permissions": [
"user:view",
"app:manage",
"database:view"
]
}
}curl -X GET http://localhost:8080/api/v2/core/users/2/login-history \
-H "Cookie: SESSIONID=your_token"Response:
{
"code": 200,
"data": [
{
"id": 1,
"userId": 2,
"ip": "192.168.1.100",
"address": "New York, USA",
"agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
"status": "success",
"message": "Login successful",
"loginAt": 1714990000,
"createdAt": 1714990000,
"updatedAt": 1714990000
},
{
"id": 2,
"userId": 2,
"ip": "192.168.1.101",
"address": "New York, USA",
"agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_0)",
"status": "success",
"message": "Login successful",
"loginAt": 1714985000,
"createdAt": 1714985000,
"updatedAt": 1714985000
}
]
}user:view- View user informationuser:create- Create new usersuser:update- Update user informationuser:delete- Delete usersuser:manage- Full user managementuser:password- Change password
host:view- View hostshost:monitor- Monitor host resourceshost:manage- Full host managementhost:create- Create host connectionshost:update- Update host informationhost:delete- Delete hosts
app:view- View applicationsapp:create- Create applicationsapp:update- Update applicationsapp:delete- Delete applicationsapp:manage- Full app managementapp:install- Install applicationsapp:uninstall- Uninstall applications
database:view- View databasesdatabase:create- Create databasesdatabase:update- Update databasesdatabase:delete- Delete databasesdatabase:manage- Full database managementdatabase:backup- Create database backups
website:view- View websiteswebsite:create- Create websiteswebsite:update- Update websiteswebsite:delete- Delete websiteswebsite:manage- Full website management
backup:view- View backupsbackup:create- Create backupsbackup:delete- Delete backupsbackup:manage- Full backup management
setting:view- View settingssetting:manage- Manage settingssystem:manage- Full system managementsystem:upgrade- System upgradessystem:log- View system logssystem:restart- Restart system
200- Success400- Bad request / Validation error401- Unauthorized / Not authenticated403- Forbidden / Insufficient permissions404- Not found500- Internal server error
{
"code": 401,
"message": "ErrNotLogin"
}{
"code": 403,
"message": "insufficient permissions"
}{
"code": 400,
"message": "ErrUserAlreadyExists"
}- All user management endpoints
- All permission endpoints
- Password reset for any user
- All system endpoints
- User viewing and management
- App management endpoints
- Database endpoints
- Website endpoints
- Backup endpoints
- Own profile and login history
- Own profile
- Password change (own only)
- View-only endpoints
- Login history (own only)
- All requests require a valid session cookie (SESSIONID)
- Role and permission validation is performed on the backend
- Failed attempts are logged and tracked by IP
- Admin role ("admin") has access to all features by default
- Custom permissions can be assigned per user
- Password changes require old password verification
- Admin can reset passwords without old password