跳转至

控制台接口

控制台接口用于获取统计数据和分析报表,帮助您了解平台使用情况。

认证方式

所有控制台接口需要使用 JWT Token 认证。

接口列表

接口 方法 说明
/api/dashboard/overview GET 控制台概览
/api/dashboard/usage_trend GET 用量趋势
/api/dashboard/api_stats GET API 统计

控制台概览

获取账户概览信息,包括余额、用量统计等。

请求

地址GET https://api.upath.cn/api/dashboard/overview

请求头

参数 必填 说明
Authorization Bearer

响应

成功响应

字段 类型 说明
balance string 当前余额(元)
total_calls integer 总调用次数
total_duration integer 总通话时长(秒)
total_charge string 总消费金额(元)
today_calls integer 今日调用次数
today_duration integer 今日通话时长(秒)
active_rooms integer 当前活跃房间数

用量趋势

获取指定时间范围内的用量趋势数据。

请求

地址GET https://api.upath.cn/api/dashboard/usage_trend

请求头

参数 必填 说明
Authorization Bearer

查询参数

参数 类型 必填 说明
period string 统计周期:day/week/month,默认 day
start_date string 开始日期(YYYY-MM-DD)
end_date string 结束日期(YYYY-MM-DD)

响应

成功响应

字段 类型 说明
period string 统计周期
data array 趋势数据列表
data[].date string 日期
data[].calls integer 调用次数
data[].duration integer 通话时长(秒)
data[].charge string 消费金额(元)

默认时间范围

不传时间参数时,默认返回最近 7 天的数据。


API 统计

获取 API 调用的详细统计数据。

请求

地址GET https://api.upath.cn/api/dashboard/api_stats

请求头

参数 必填 说明
Authorization Bearer

查询参数

参数 类型 必填 说明
start_date string 开始日期(YYYY-MM-DD)
end_date string 结束日期(YYYY-MM-DD)

响应

成功响应

字段 类型 说明
total_requests integer 总请求数
success_requests integer 成功请求数
failed_requests integer 失败请求数
success_rate string 成功率(百分比)
avg_response_time integer 平均响应时间(毫秒)
by_action array 按接口分类统计
by_action[].action string 接口名称
by_action[].count integer 调用次数
by_action[].success_count integer 成功次数
by_action[].avg_time integer 平均响应时间

使用建议

监控告警

建议定期查看以下指标:

指标 建议阈值 说明
余额 < 10 元 及时充值避免服务中断
成功率 < 95% 检查是否存在异常
响应时间 > 3000ms 可能存在网络问题

成本优化

通过用量趋势分析,可以:

  • 了解业务高峰时段
  • 优化调用策略
  • 预估月度费用