Skip to main content
Version: latest

获取问卷详情

接口概述#

  • 功能:获取问卷详情
  • 请求方式:GET
  • 请求地址:/api/surveys/{survey_id}/legacy?appid={appid}&access_token={access_token}

请求参数#

参数名类型参数位置描述示例值
survey_idintegeruri问卷ID292192

响应参数#

基本内容#

参数名类型描述
idinteger编号
hashstring哈希
scenestring场景,参考下方问卷场景
titlestring标题
prefixstring欢迎语
suffixstring结束语
pagesarray[page]问卷内容页列表,参考下方单页内容
page_countinteger页数
topic_countinteger问题数
startTimeinteger回收开始时间
endTimeinteger回收结束时间
createTimeinteger创建时间
updateTimeinteger更新时间
stateinteger状态,0:草稿, 2:回收中, 3:暂停回收
template_idinteger使用的模板ID,对应 template_system 表
creator_user_idinteger问卷创建者的用户ID

问卷场景#

场景名枚举值描述
旧版问卷0
普通问卷1当不存在 survey.scene 时,也为普通问卷
旧版的考试问卷2已废弃
考试问卷3
疫情问卷4
360度评估场景5
测评场景6
报名签到7

单页内容#

参数名类型描述
idstring单页标识
indexstring序号
questionsarray[question]问题列表,参考下方题目内容

题目内容#

参数名类型描述
question.typestring题目类型,可参考题目类型
question.sub_typestring题目子类型,枚举可参考题目类型
question.titlestring题目标题
question.descriptionstring题目备注
question.requiredbool是否必答
question.gotoobject答题后跳转题目
question.blank_settingarray选项中的"其他"填空
question.hiddenbool是否隐藏
question.prefillbool预填内容
question.randombool是否随机
question.maxRowobject多选题一行显示的个数
question.referobject选项引用的题号
question.optionsarray[object]选项列表,参考下方选项内容
question.assessobject测评题
question.idstring题目 ID
question.real_indexinteger
question.indexinteger题目编号
question.maxlengthobject多选题 最多可选 ,单行文本题、多行文本题 最大字数
question.validatestring文本验证规则,包括 `('number'
question.rowsobject多行文本题行数
question.colsobject多行文本题列数
question.starShowstring量表类型
question.otherStrstring废弃字段
question.isOtherbool废弃字段
question.starBeginNuminteger量表题起始值
question.starNumobject量表范围,2~10
question.starTypeobject量表类型
question.revertSortobject是否反转,数值默认从小到大排
question.starShowCustomStartstring量表题起始文案
question.starShowCustomEndstring量表题起末尾文案
question.starOptionsarray[int]
question.subTitlesarray[object]矩阵题子问题列表
question.subTitles[_].idstring矩阵题子问题 ID
question.subTitles[_].textstring矩阵题子问题文本
question.levelsarray[string]联动题各级标题
question.groupsarray[object]联动题列表(嵌套) [选项ID,选项文本, 子选项列表]
question.file_type_limitarray[string]允许上传文件类型
question.file_size_limitobject允许上传文件大小(KB)

题目类型#

题目类型分为 typesub_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考试场景
评估单选7360场景
矩阵评估单选8360场景
测评单选9测评场景
测评多选10测评场景
自定义量表11测评场景
评分12全场景
矩阵评分13全场景

选项内容#

参数名类型描述
option.idstring选项 ID
option.gotoobject选择选项后跳转题目
option.displayobject选择选项后显示题目
option.noRandombool题目设置选项随机的时候,固定当前选项位置
option.textstring选项文案
option.exclusivebool当题目为多选题的时候,设置当前选项为互斥选项

基本设置#

参数名类型描述
prevbool是否允许回到上一页
titleIndexbool是否显示题目序号
login_checkbool是否开启登陆验证
answer_countinteger允许回答次数
whitelist_enablebool是否开启白名单
redirect_urlstring答题后跳转链接
webhook_urlstring答题后推送数据的地址
survey_typeinteger问卷类型 0:普通问卷 1:测评问卷
questions_randomarray[string]数组,题目随机顺序
is_allow_update_answerbool是否允许修改答案
is_enabled_locationbool是否获取用户位置信息
is_access_surveybool是否为测评问卷

响应示例#

  • 请求成功
{    "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获取数据错误