获取问卷详情
#
接口概述- 功能:获取问卷详情
- 请求方式:GET
- 请求地址:/api/surveys/{survey_id}/legacy?appid={appid}&access_token={access_token}
#
请求参数参数名 | 类型 | 参数位置 | 描述 | 示例值 |
---|---|---|---|---|
survey_id | integer | uri | 问卷ID | 292192 |
#
响应参数#
基本内容参数名 | 类型 | 描述 |
---|---|---|
id | integer | 编号 |
hash | string | 哈希 |
scene | string | 场景,参考下方问卷场景 |
title | string | 标题 |
prefix | string | 欢迎语 |
suffix | string | 结束语 |
pages | array[page] | 问卷内容页列表,参考下方单页内容 |
page_count | integer | 页数 |
topic_count | integer | 问题数 |
startTime | integer | 【废弃】回收开始时间 |
endTime | integer | 【废弃】回收结束时间 |
started_at | string | 回收开始时间 e.g. 2024-06-01 00:00:00 |
end_at | string | 回收结束时间 e.g. 2024-07-01 00:00:00 |
createTime | integer | 创建时间 |
updateTime | integer | 更新时间 |
state | integer | 状态,0:草稿, 2:回收中, 3:暂停回收 |
template_id | integer | 使用的模板ID,对应 template_system 表 |
creator_user_id | integer | 问卷创建者的用户ID |
#
问卷场景场景名 | 枚举值 | 描述 |
---|---|---|
旧版问卷 | 0 | |
普通问卷 | 1 | 当不存在 survey.scene 时,也为普通问卷 |
旧版的考试问卷 | 2 | 已废弃 |
考试问卷 | 3 | |
疫情问卷 | 4 | |
360度评估场景 | 5 | |
测评场景 | 6 | |
报名签到 | 7 |
#
问卷状态场景名 | 枚举值 |
---|---|
草稿 | 0 |
回收中 | 2 |
暂停回收 | 3 |
#
单页内容参数名 | 类型 | 描述 |
---|---|---|
id | string | 单页标识 |
index | string | 序号 |
questions | array[question] | 问题列表,参考下方题目内容 |
#
题目内容参数名 | 类型 | 描述 |
---|---|---|
question.type | string | 题目类型,可参考题目类型 |
question.sub_type | string | 题目子类型,枚举可参考题目类型 |
question.title | string | 题目标题 |
question.description | string | 题目备注 |
question.required | bool | 是否必答 |
question.goto | object | 答题后跳转题目 |
question.blank_setting | array | 选项中的"其他"填空 |
question.hidden | bool | 是否隐藏 |
question.prefill | bool | 预填内容 |
question.random | bool | 是否随机 |
question.maxRow | object | 多选题一行显示的个数 |
question.refer | object | 选项引用的题号 |
question.options | array[object] | 选项列表,参考下方选项内容 |
question.assess | object | 测评题 |
question.id | string | 题目 ID |
question.real_index | integer | |
question.index | integer | 题目编号 |
question.maxlength | object | 多选题 最多可选 ,单行文本题、多行文本题 最大字数 |
question.validate | string | 文本验证规则,包括 `('number' |
question.rows | object | 多行文本题行数 |
question.cols | object | 多行文本题列数 |
question.starShow | string | 量表类型 |
question.otherStr | string | 废弃字段 |
question.isOther | bool | 废弃字段 |
question.starBeginNum | integer | 量表题起始值 |
question.starNum | object | 量表范围,2~10 |
question.starType | object | 量表类型 |
question.revertSort | object | 是否反转,数值默认从小到大排 |
question.starShowCustomStart | string | 量表题起始文案 |
question.starShowCustomEnd | string | 量表题起末尾文案 |
question.starOptions | array[int] | |
question.subTitles | array[object] | 矩阵题子问题列表 |
question.subTitles[_].id | string | 矩阵题子问题 ID |
question.subTitles[_].text | string | 矩阵题子问题文本 |
question.levels | array[string] | 联动题各级标题 |
question.groups | array[object] | 联动题列表(嵌套) [选项ID,选项文本, 子选项列表] |
question.file_type_limit | array[string] | 允许上传文件类型 |
question.file_size_limit | object | 允许上传文件大小(KB) |
#
题目类型题目类型分为 type
和 sub_type
,其中有 sub_type
优先根据 sub_type
判断,否则则由 type
判断。
type
#
题型 | 值 |
---|---|
单选 | 'radio' |
多选 | 'checkbox' |
下拉 | 'select' |
单行文本 | 'text' |
多行文本 | 'textarea' |
量表/NPS | 'star' |
排序 | 'sort' |
矩阵单选 | 'matrix_radio' |
矩阵多选 | 'matrix_checkbox' |
矩阵量表 | 'matrix_star' |
矩阵填空 | 'matrix_blank' |
联动 | 'chained_selects' |
图片/文件 | 'upload' |
文本描述 | 'description' |
填空(旧) | 'text_multiple' |
填空 | 'blanks' |
日期/时间 | 'datetime' |
手写签名 | 'signature' |
地理位置 | 'address' |
手机号 | 'phone' |
自增表格 | 'sheet |
sub_type
#
题型 | 值 | 对应场景 |
---|---|---|
默认值 | 0 | 考试场景 |
单选 | 1 | 考试场景 |
多选 | 2 | 考试场景 |
不定项选择 | 3 | 考试场景 |
判断 | 4 | 考试场景 |
多项填空 | 5 | 考试场景 |
问答题 | 6 | 考试场景 |
评估单选 | 7 | 360场景 |
矩阵评估单选 | 8 | 360场景 |
测评单选 | 9 | 测评场景 |
测评多选 | 10 | 测评场景 |
自定义量表 | 11 | 测评场景 |
评分 | 12 | 全场景 |
矩阵评分 | 13 | 全场景 |
#
选项内容参数名 | 类型 | 描述 |
---|---|---|
option.id | string | 选项 ID |
option.goto | object | 选择选项后跳转题目 |
option.display | object | 选择选项后显示题目 |
option.noRandom | bool | 题目设置选项随机的时候,固定当前选项位置 |
option.text | string | 选项文案 |
option.exclusive | bool | 当题目为多选题的时候,设置当前选项为互斥选项 |
#
基本设置参数名 | 类型 | 描述 |
---|---|---|
prev | bool | 是否允许回到上一页 |
titleIndex | bool | 是否显示题目序号 |
login_check | bool | 是否开启登陆验证 |
answer_count | integer | 允许回答次数 |
whitelist_enable | bool | 是否开启白名单 |
redirect_url | string | 答题后跳转链接 |
webhook_url | string | 答题后推送数据的地址 |
survey_type | integer | 问卷类型 0:普通问卷 1:测评问卷 |
questions_random | array[string] | 数组,题目随机顺序 |
is_allow_update_answer | bool | 是否允许修改答案 |
is_enabled_location | bool | 是否获取用户位置信息 |
is_access_survey | bool | 是否为测评问卷 |
#
响应示例- 请求成功
{ "code": "OK", "error": { "type": "", }, "data": { "id": 292192, "title": "<p>问卷标题</p>", "prefix": "<p>为了给您提供更好的服务,希望您能抽出几分钟时间,将您的感受和建议告诉我们,我们非常重视每位用户的宝贵意见,期待您的参与!现在我们就马上开始吧!</p>\n", "suffix": "<p><img alt="问卷已经100%完成" src="/statics/end.png" /></p>\n\n<p> </p>\n\n<p>问卷到此结束,感谢您的参与!</p>\n", "callback": "", "endTime": 0, "hash": "d082", "show_stat": false, "ip": false, "pc": false, "prev": false, "titleIndex": true, "createTime": 1624860743, "updateTime": 1625107870, "startTime": 1624861103, "lang": "zh", "purpose": "备注信息", "state": 2, "pages": [ { "id": 1, "index": 0, "questions": [ { "type": "radio", "title": "<p>单选题</p>\n", "description": "<p>单选备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": "1", "refer": null, "options": [ { "id": "o-100-ABCD", "goto": "", "display": [], "noRandom": false, "text": "<p>单选答案1</p>\n" }, { "id": "o-101-EFGH", "goto": "", "display": [], "noRandom": false, "text": "<p>单选答案2</p>\n" } ], "id": "q-1-qkPo" }, { "type": "select", "title": "<p>下拉题</p>\n", "description": "<p>下拉备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": "1", "refer": null, "options": [ { "id": "o-100-ABCD", "goto": "", "display": [], "noRandom": false, "text": "下拉题目1" }, { "id": "o-101-EFGH", "goto": "", "display": [], "noRandom": false, "text": "下拉题目2" } ], "id": "q-2-EWMS" }, { "type": "checkbox", "title": "<p>多选题</p>\n", "description": "<p>多选备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": "1", "refer": "", "options": [ { "id": "o-100-ABCD", "goto": "", "display": [], "noRandom": false, "text": "<p>多选答案1</p>\n" }, { "id": "o-101-EFGH", "goto": "", "display": [], "noRandom": false, "text": "<p>多选答案2</p>\n" }, { "id": "o-2-tINm", "goto": "", "display": [], "noRandom": false, "text": "<p>多选答案3</p>\n" } ], "id": "q-3-iBsI", "maxlength": 0 }, { "type": "text", "title": "<p>单行文本题</p>\n", "description": "<p>单行文本备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": null, "id": "q-4-5Vtm", "maxlength": "" }, { "type": "textarea", "title": "<p>多行文本题</p>\n", "description": "<p>多行文本备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": null, "id": "q-5-U149", "rows": "5", "cols": "60" }, { "type": "star", "title": "<p>量表题</p>\n", "description": "<p>量表题备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": null, "id": "q-6-0uZR", "starShow": "满意", "otherStr": "不清楚", "starBeginNum": 1, "starNum": "5", "starType": "default", "revertSort": 0 }, { "type": "matrix_radio", "title": "<p>矩阵单选题</p>\n", "description": "<p>矩阵单选备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": [ { "id": "o-100-ABCD", "goto": null, "display": null, "noRandom": false, "text": "<p>选项1</p>\n" }, { "id": "o-101-EFGH", "goto": null, "display": null, "noRandom": false, "text": "<p>选项2</p>\n" } ], "id": "q-7-nOBv", "subTitles": [ { "id": "g-1-ABCD", "text": "<p>问题1</p>\n" }, { "id": "g-2-EFGH", "text": "<p>问题2</p>\n" } ] }, { "type": "matrix_checkbox", "title": "<p>矩阵多选题</p>\n", "description": "<p>矩阵多选备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": [ { "id": "o-100-ABCD", "goto": null, "display": null, "noRandom": false, "text": "<p>选项1</p>\n" }, { "id": "o-101-EFGH", "goto": null, "display": null, "noRandom": false, "text": "<p>选项2</p>\n" } ], "id": "q-8-B3fI", "subTitles": [ { "id": "g-1-ABCD", "text": "<p>问题1</p>\n" }, { "id": "g-2-EFGH", "text": "<p>问题2</p>\n" } ] }, { "type": "matrix_star", "title": "<p>qq</p>\n", "description": "<p>矩阵量表题备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": null, "id": "q-14-hYBP", "starShow": "满意", "otherStr": "不清楚", "starBeginNum": 1, "starNum": "5", "starType": "default", "revertSort": 0, "subTitles": [ { "id": "g-1-ABCD", "text": "<p>问题</p>\n" }, { "id": "g-2-EFGH", "text": "<p>问题</p>\n" } ] } ] }, { "id": "p-2-bKoP", "index": 1, "questions": [ { "type": "sort", "title": "<p>排序题</p>\n", "description": "<p>排序题备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": [ { "id": "o-100-ABCD", "goto": null, "display": null, "noRandom": false, "text": "<p>选项1</p>\n" }, { "id": "o-101-EFGH", "goto": null, "display": null, "noRandom": false, "text": "<p>选项2</p>\n" } ], "id": "q-9-XKAl" }, { "type": "chained_selects", "title": "<p>联动题</p>\n", "description": "<p>联动题备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": null, "id": "q-10-XC8E", "levels": [ "一级标题", "二级标题", "三级标题" ], "groups": [ [ "2-wA", "一级答案", [ [ "3-v9", "二级答案", [ [ "4-1L", "三级答案" ] ] ] ] ] ] }, { "type": "upload", "title": "<p>附加题</p>\n", "description": "<p>附加题备注</p>\n", "required": true, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": null, "id": "q-11-3rG8", "file_type_limit": [ "gif", "png", "jpg", "jpeg", "bmp", "doc", "docx", "pdf", "xls", "xlsx", "ppt", "pptx", "txt", "zip", "gzip", "rar" ], "file_size_limit": 5120 }, { "type": "description", "title": "<p>文本描述</p>\n", "description": "", "required": false, "goto": "", "blank_setting": [], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": null, "id": "q-12-SSoF" }, { "type": "text_multiple", "title": "<p>题目: 这是填空题<span class="mod_fillblank" data-id="fillblank-7TqK">________</span></p>\n", "description": "<p>填空题备注</p>\n", "required": true, "goto": "", "blank_setting": [ { "attach_id": "q-13-ngwO", "id": "fillblank-7TqK", "type": "question", "validate": null } ], "hidden": false, "prefill": false, "random": false, "maxRow": null, "refer": null, "options": null, "id": "q-13-ngwO" } ] } ], "url": "", "thumb_url": "/thumb/92/292192_s.jpg", "styles": { "custom": [], "skinId": "default", "theme": "default" }, "previewURL": "", "page_count": 2, "topic_count": 14, "reward": { "name": "", "contact": "", "endDateTime": 0, "deliverMethod": "", "lotteryMethod": "", "winPrizeProbability": "", "reward_type": 0, "reward_cnt": 0, "reward_flag": 0, "list": null, "status": 0 }, "default_reward": false, "is_enabled_luckymoney": false, "is_enabled_common_luckymoney": false, "is_enabled_samples": false, "has_ongoing_groups": false, "login_check": false, "answer_count": 0, "whitelist_enable": false, "whitelist_type": -1, "login": false, "survey_type": 0, "create_owner": 60000208235, "creator_user_id": 60000208235, "survey_rules": { "list": [], "positions": [], "version": "1.0" }, "survey_dsl": null, "hide_tencent_relevant_allowed": false, "hide_tencent_relevant": false, "custom_copyright": "", "redirect_url": "", "webhook_url": "", "remark_name": "", "questions_random": [], "is_register": false, "is_enabled_data_cleaner": false, "is_allow_update_answer": false, "is_enabled_attendance": false, "daily_attendance_count": 1, "is_enabled_location": false, "is_enabled_attendance_cert": false, "is_hide_advertisement": false, "is_allow_get_healthy_status": false, "is_redirect_url_verified": false, "recycle": 0, "validCount": 0, "cache": "", "skin": { "id": 1, "object_id": 0, "object_type": 1, "name": "默认皮肤", "theme_color": "n1", "scheme_color": 0, "support_color": "", "background_image": "/default/skin/background_1.png", "preview_image": "/default/skin/preview-default.png", "is_show_logo_image": false, "logo_image": "/default/skin/logo_color.png", "logo_position": 1, "theme_v1": "", "is_hidden": false, "is_top": false, "position": 0, "creator": 0, "status": 1, "created_at": "2020-11-19 20:22:55", "updated_at": "2020-11-19 20:22:55" }, "is_access_survey": false, "code": 0, "credit_level": 0, "timestamp": 0, "is_sample_user": false, "sample_reward_type": 0, "sample_reward_amount": 0, "admin_enable": false, "answer_alert": { "survey_id": 292192, "status": 0, "type": 0, "counter": 0, "limit": 24, "operator_id": 0, "update_time": 1625107870, "send_cnt": 0 }, "answer_notice": false, "checkin_started_at": "", "checkin_expired_at": "", "checkin_qrcode_uri": "/api/qrcode?data=%2Fapi%2Fcollect%2Fregistration_redirect%3Fsurvey_id%3D292192%26hash%3Dd082%26registration_token%3D02f9d704c6316a44519ef788a2a04872", "is_checkin_approved_only": false, "is_remind_before_checkin": false, "is_allowed_enable_attendance_cert": false, "is_current_user_weiyun_binding": false, "is_enabled_weiyun": false, "weiyun_user_id": 0, "survey_user": { "level": 0, "level_str": "", "granted_query": null, "granted_search": null }, "template_id": 0 }, "request_id": "e4b27037-d876-427d-95c7-d5a737dd1677"}
- 请求失败
{ "code": "InvalidArgument", "error": { "type": "invalid_argument", }, "data": {}, "request_id": "ddec96d2-165e-4f3e-8a64-2057db116983"}
#
错误码error.type 错误代码 | 错误描述 |
---|---|
invalid_auth_status | 权限类型错误 |
claim_error | 权限校验错误 |
get_survey_error | 获取数据错误 |