提交 API
以编程方式创建和获取反馈提交。
提交列表
GET /api/v2/submissions
查询参数
| 参数 | 类型 | 说明 |
|---|---|---|
page | integer | 页码(默认:1) |
per_page | integer | 每页条数(默认:15,最大:100) |
status | string | 按状态筛选:pending、approved、resolved、spam |
campaign_id | integer | 按活动 ID 筛选 |
product_id | integer | 按产品 ID 筛选 |
from | date | 开始日期(YYYY-MM-DD) |
to | date | 结束日期(YYYY-MM-DD) |
示例
curl "https://yourdomain.com/api/v2/submissions?status=approved&per_page=10" \
-H "Authorization: Bearer YOUR_API_KEY"
响应
{
"data": [
{
"id": 42,
"campaign_id": 1,
"product_id": 1,
"star_rating": 5,
"nps_score": 9,
"text_feedback": "Absolutely love this product!",
"customer_name": "Jane Doe",
"customer_email": "[email protected]",
"sentiment_score": 0.92,
"sentiment_label": "positive",
"status": "approved",
"is_public": true,
"admin_reply": "Thank you, Jane! We're glad you love it.",
"created_at": "2024-03-15T10:30:00Z"
}
],
"meta": {
"current_page": 1,
"per_page": 10,
"total": 42
}
}
获取单条提交
GET /api/v2/submissions/{id}
示例
curl "https://yourdomain.com/api/v2/submissions/42" \
-H "Authorization: Bearer YOUR_API_KEY"
创建提交
POST /api/v2/submissions
请求体
{
"campaign_id": 1,
"star_rating": 5,
"nps_score": 9,
"text_feedback": "Great product, very intuitive!",
"customer_name": "John Smith",
"customer_email": "[email protected]"
}
参数
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
campaign_id | integer | 是 | 提交目标活动 |
star_rating | integer | 否 | 1-5 星级评分 |
nps_score | integer | 否 | 0-10 NPS 分数 |
text_feedback | string | 否 | 自由文本反馈 |
customer_name | string | 否 | 提交者姓名 |
customer_email | string | 否 | 提交者邮箱 |
survey_responses | object | 否 | 自定义问卷字段答案 |
响应(201 Created)
{
"data": {
"id": 43,
"campaign_id": 1,
"star_rating": 5,
"status": "pending",
"created_at": "2024-03-15T11:00:00Z"
},
"message": "Submission created successfully"
}