获取回答列表
#
接口概述- 功能:获取问卷的回答列表
- 请求方式:GET
- 请求地址:/api/surveys/{survey_id}/answers?appid={appid}&access_token={access_token}&per_page={1}&last_answer_id={0}
#
请求参数参数名 | 类型 | 参数位置 | 描述 | 示例值 |
---|---|---|---|---|
survey_id | integer | uri | 问卷ID | 292192 |
per_page | integer | queryString | 每页显示条数 | 20 |
last_answer_id | integer | queryString | 下页开始ID | 2 |
#
响应参数参数名 | 类型 | 描述 |
---|---|---|
total | integer | 总条数 |
last_answer_id | integer | 下一页从此ID开始(用于分页) |
list | array[object] | 回答列表(每个问卷的结构不一样,结构也会有所出入,实际数据结构以实际推送的为准) |
list[_].answer_id | integer | 答案ID |
list[_].qq | integer | 用户标识 |
list[_].openid | string | 非微信OpenID,废弃字段 |
list[_].started_at | string | 用户开始回答的时间 |
list[_].ended_at | string | 用户提交答案的时间 |
list[_].score | integer | 用户回答的分数(默认null)(暂不提供) |
list[_].wechat_work_user | object | 企业微信用户信息(特定使用) |
list[_].third_party_user | object | 第三方用户信息(特定使用,关联第三方系统对接) |
list[_].answer | array[object] | 用户的回答详情 |
#
响应参数-answer参数名 | 类型 | 描述 |
---|---|---|
id | string | 问卷页码 |
questions | array[object] | 详细回答详情 |
questions[_].id | string | 题目ID |
question[_].type | string | 题目类型,可参考题目类型 |
question[_].sub_type | string | 题目子类型,枚举可参考题目类型 |
questions[_].text | string | 文本输入(单行文本、多行文本、量表题等) |
questions[_].options | array[object] | 选择输入(下拉、多选、排序等) |
questions[_].options[_].id | string | 回答ID |
questions[_].options[_].checked | integer | 是否选中(默认1) |
questions[_].options[_].text | string | 回答内容 |
questions[_].groups | array[object] | 组合输入(矩阵多选、矩阵单选、矩阵量表等) |
questions[_].groups[_].id | string | 回答ID |
questions[_].groups[_].text | string | 矩阵量表题 |
questions[_].groups[_].options | array[object] | 组合详情 |
questions[_].groups[_].options[_].id | string | 回答ID |
questions[_].groups[_].options][_].checked | integer | 是否选中(默认1) |
questions[_].groups[_].options][_].text | string | 回答内容 |
questions[_].blanks | array[object] | 填空题 |
questions[_].blanks[_].id | string | 填空题ID |
questions[_].blanks[_].value | string | 填空题内容 |
questions[_].id_list | array[string] | 联动题-题目ID |
questions[_].text_list | array[string] | 联动题-ID对应内容 |
questions[_].file_name_src | string | 废弃 |
questions[_].file_name_dst | string | 废弃 |
questions[_].files | array[object] | 回答者上传的附件 |
questions[_].files[_].name | string | 附件名称 |
questions[_].files[_].url | string | 附件下载地址(有效期7天) |
#
响应参数-第三方用户信息-third_party_user参数名 | 类型 | 描述 |
---|---|---|
third_party_user.respondent_id | integer | 问卷系统中回答者身份ID,与创建第三方用户返回值对应 |
third_party_user.openid | string | 第三方用户标识 |
third_party_user.nickname | string | 第三方用户昵称 |
#
响应示例- 请求成功
{ "code": "OK", "error": { "type": "" }, "data": { "total": 1, "list": [ { "survey_id": 292192, "answer_id": 4, "qq": 60000000004, "openid": "", "started_at": "2021-06-28 14:18:38", "ended_at": "2021-06-28 14:20:16", "score": 1, "wechat_work_user": { "corpid": "", "company_name": "", "user_id": "", "department_ids": null, "name": "" }, "third_party_user": { "respondent_id": 60000000004, "openid": "abcdefg", "nickname": "张三" }, "answer": [ { "id": "1", "questions": [ { "id": "q-1-qkPo", "type": "radio", "options": [ { "id": "o-100-ABCD", "checked": 1, "text": "<p>单选答案1</p>\n" } ] }, { "id": "q-2-EWMS", "type": "select", "options": [ { "id": "o-101-EFGH", "checked": 1, "text": "下拉题目2" } ] }, { "id": "q-3-iBsI", "type": "checkbox", "options": [ { "id": "o-2-tINm", "checked": 1, "text": "<p>多选答案3</p>\n" } ] }, { "id": "q-4-5Vtm", "type": "text", "text": "单行文本-自己输入的" }, { "id": "q-5-U149", "type": "textarea", "text": "多行文本\n自己输入的" }, { "id": "q-6-0uZR", "type": "star", "text": "4" }, { "id": "q-7-nOBv", "type": "matrix_radio", "groups": [ { "id": "g-1-ABCD", "options": [ { "id": "o-100-ABCD", "checked": 1, "text": "<p>选项1</p>\n" } ] }, { "id": "g-2-EFGH", "options": [ { "id": "o-101-EFGH", "checked": 1, "text": "<p>选项2</p>\n" } ] } ] }, { "id": "q-8-B3fI", "type": "matrix_checkbox", "groups": [ { "id": "g-1-ABCD", "options": [ { "id": "o-100-ABCD", "checked": 1, "text": "<p>选项1</p>\n" }, { "id": "o-101-EFGH", "checked": 1, "text": "<p>选项2</p>\n" } ] }, { "id": "g-2-EFGH", "options": [ { "id": "o-100-ABCD", "checked": 1, "text": "<p>选项1</p>\n" } ] } ] } ] }, { "id": "p-2-bKoP", "questions": [ { "id": "q-9-XKAl", "type": "sort", "options": [ { "id": "o-101-EFGH", "checked": 0, "text": "" }, { "id": "o-100-ABCD", "checked": 0, "text": "" } ] }, { "id": "q-10-XC8E", "type": "chained_selects", "id_list": [ "2-wA", "3-v9", "4-1L" ], "text_list": [ "一级答案", "二级答案", "三级答案" ] }, { "id": "q-11-3rG8", "type": "upload", "file_name_src": "logo.png", "file_name_dst": "292192_0_6603fef4e5abd7616bfef24eb516aaef.png", "files": [ { "name": "logo.png", "url": "https://wj.qq.com/api/files/show?file_id=123&survey_id=292192&question_id=q-11-3rG8&file_name=292192_0_6603fef4e5abd7616bfef24eb516aaef.png" }, { "name": "logo2.png", "url": "https://wj.qq.com/api/files/show?file_id=124&survey_id=292192&question_id=q-11-3rG8&file_name=292192_0_6603fef4e5abd7616bfef24eb516aaeh.png" } ], "expired": "7d" }, { "id": "q-13-ngwO", "type": "text_multiple", "blanks": [ { "id": "fillblank-7TqK", "value": "填什么呀" } ] } ] }, { "id": "custom_args", "questions": [ { "id": "custom-arg-01", "type": "text", "text": "123" } ] } ] } ], "last_answer_id": 1, "request_id": "e4b27037-d876-427d-95c7-d5a737dd1677" }}
- 请求失败
{ "code": "InvalidArgument", "error": { "type": "invalid_argument", }, "data": {}, "request_id": "ddec96d2-165e-4f3e-8a64-2057db116983"}
#
错误码error.type 错误代码 | 错误描述 |
---|---|
not_found | 找不到数据 |
claim_error | 权限校验错误 |
invalid_argument | 参数校验不通过 |