Agent Service API
Authentication
# Get token
POST /api/auth/token
Content-Type: application/json
{
"username": "admin@bytedesk.com",
"password": "password"
}
# Response
{
"access_token": "eyJhbGciOiJIUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600
}
Agent Management
Get Agent List
GET /api/agent/list
Authorization: Bearer {token}
# Response
{
"code": 200,
"data": [
{
"id": "agent_id",
"nickname": "Agent Name",
"avatar": "https://example.com/avatar.jpg",
"status": "online",
"role": "agent"
}
]
}
Update Agent Status
PUT /api/agent/status
Authorization: Bearer {token}
Content-Type: application/json
{
"status": "online" // online, offline, busy, away
}
# Response
{
"code": 200,
"message": "Status updated successfully"
}
Get Agent Statistics
GET /api/agent/stats
Authorization: Bearer {token}
# Response
{
"code": 200,
"data": {
"total_chats": 100,
"avg_response_time": 30,
"satisfaction_rate": 4.5,
"online_duration": 28800
}
}
Error Codes
Code | Description |
---|---|
200 | Success |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Server Error |