NueForm

分析 API

检索表单的响应指标和完成率分析数据。

分析 API 提供表单响应的聚合指标,包括总数、完成率和每日明细。

所有响应体均使用 snake_case 字段命名。

表单分析仪表板
分析仪表板展示响应指标和完成率。

获取表单分析

GET/api/v1/forms/:id/analytics

返回指定表单的响应分析数据。您可以选择性地筛选日期范围以分析特定时间段。

路径参数

idstring

表单 ID

查询参数

sincestring

ISO 8601 日期。仅包含在此日期或之后提交的响应。

untilstring

ISO 8601 日期。仅包含在此日期或之前提交的响应。

响应字段

form_idstring

表单 ID

total_responsesinteger

提交总数(包括部分提交)

completed_responsesinteger

完整提交的数量

completion_ratenumber

完成响应的百分比(0-100,保留两位小数)

average_completion_time_secondsinteger or null

从首次回答到完成的平均时间(秒)。如果没有已完成的响应则为 null

responses_by_dayarray

按日统计的响应数量明细

responses_by_day[].datestring

日期,格式为 YYYY-MM-DD

responses_by_day[].totalinteger

该日期的总响应数

responses_by_day[].completedinteger

该日期的已完成响应数

响应

json
{
  "form_id": "665a1b2c3d4e5f6a7b8c9d0e",
  "total_responses": 342,
  "completed_responses": 298,
  "completion_rate": 87.13,
  "average_completion_time_seconds": 194,
  "responses_by_day": [
    { "date": "2026-02-22", "total": 18, "completed": 16 },
    { "date": "2026-02-23", "total": 24, "completed": 21 },
    { "date": "2026-02-24", "total": 31, "completed": 27 },
    { "date": "2026-02-25", "total": 22, "completed": 20 },
    { "date": "2026-02-26", "total": 28, "completed": 25 },
    { "date": "2026-02-27", "total": 35, "completed": 30 },
    { "date": "2026-02-28", "total": 12, "completed": 11 }
  ]
}

代码示例

bash
curl -X GET "https://api.nueform.io/api/v1/forms/665a1b2c3d4e5f6a7b8c9d0e/analytics?since=2026-02-01&until=2026-02-28" \
  -H "Authorization: Bearer YOUR_API_KEY"

查询技巧

使用 sinceuntil 查询参数来控制分析的日期范围。

完整历史

省略 sinceuntil 参数即可获取表单整个生命周期内的分析数据。

最近 7 天

计算 7 天前的日期并将其作为 since 参数传入,即可获取滚动的每周窗口数据。

指定月份

将该月的第一天和最后一天分别作为 sinceuntil 传入,即可获取特定日历月的分析数据。

完整历史

bash
curl -X GET "https://api.nueform.io/api/v1/forms/665a1b2c3d4e5f6a7b8c9d0e/analytics" \
  -H "Authorization: Bearer YOUR_API_KEY"

最近 7 天

javascript
const since = new Date();
since.setDate(since.getDate() - 7);

const response = await fetch(
  `https://api.nueform.io/api/v1/forms/${formId}/analytics?since=${since.toISOString().split("T")[0]}`,
  { headers: { Authorization: "Bearer YOUR_API_KEY" } }
);

指定月份

python
response = requests.get(
    f"https://api.nueform.io/api/v1/forms/{form_id}/analytics",
    params={"since": "2026-01-01", "until": "2026-01-31"},
    headers={"Authorization": "Bearer YOUR_API_KEY"},
)

错误响应

此端点返回的标准错误响应。

错误码

400Bad Request

sinceuntil 的日期格式无效

401Unauthorized

缺少或无效的 API 密钥

403Forbidden

团队表单权限不足

404Not Found

表单未找到

500Server Error

服务器内部错误

错误示例

json
{
  "error": "Form not found"
}
最后更新:2026年4月6日