活动日志 API
活动日志 API 允许你跟踪和管 理设备和账号的活动日志。这对于监控自动化任务执行的操作非常有用。
添加活动日志
添加新的活动日志条目。
端点: POST /api/v1/activity_log
请求体:
{
"platform": "tiktok",
"serial": "device_serial_123",
"action_type": "post",
"action_detail": "成功发布视频",
"username": "user123",
"timestamp": 1707725000
}
响应:
{
"code": 0,
"message": "success",
"data": {
"id": 123
}
}
获取活动日志
检索带有可选过滤器的活动日志。
端点: GET /api/v1/activity_log
查询参数:
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
| platform | string | 否 | 按平台过滤(例如:"tiktok"、"instagram") |
| serial | string | 否 | 按设备序列号过滤 |
| action_type | string | 否 | 按操作类型过滤(例如:"post"、"follow"、"comment") |
| limit | integer | 否 | 返回的记录数(默认:100,最大:1000) |
| offset | integer | 否 | 用于分页的跳过记录数 |
请求示例:
curl "http://localhost:50809/api/v1/activity_log?platform=tiktok&limit=50&offset=0"
响应:
{
"code": 0,
"message": "success",
"data": [
{
"id": 123,
"platform": "tiktok",
"serial": "device_serial_123",
"action_type": "post",
"action_detail": "成功发布视频",
"username": "user123",
"timestamp": 1707725000
}
]
}
获取活动日志计数
获取符合过滤条件的活动日志总数。
端点: GET /api/v1/activity_log/count
查询参数:
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
| platform | string | 否 | 按平台过滤 |
| serial | string | 否 | 按设备序列号过滤 |
| action_type | string | 否 | 按操作类型过滤 |
请求示例:
curl "http://localhost:50809/api/v1/activity_log/count?platform=tiktok"
响应:
{
"code": 0,
"message": "success",
"data": {
"count": 456
}
}
删除活动日志
按 ID 删除特定的活动日志条目。
端点: DELETE /api/v1/activity_log/{id}
请求示例:
curl -X DELETE "http://localhost:50809/api/v1/activity_log/123"
响应:
{
"code": 0,
"message": "success",
"data": {
"deleted": true,
"id": 123
}
}
删除所有活动日志
删除所有活动日志条目。
端点: DELETE /api/v1/activity_log/all
请求示例:
curl -X DELETE "http://localhost:50809/api/v1/activity_log/all"
响应:
{
"code": 0,
"message": "success",
"data": {
"deleted": true,
"message": "所有活动日志已删除"
}
}