获取问卷详情(完整版字段)
接口概述
- 功能:获取问卷详情
- 请求方式: GET
- 请求地址:/api/surveys/{survey_id}/legacy
请求参数
| 参数名 | 类型 | 参数位置 | 描述 | 示例值 |
|---|---|---|---|---|
| survey_id | integer | uri | 问卷ID | 292192 |
响应参数
基本内容
| 参数名 | 类型 | 描述 |
|---|---|---|
| id | integer | 编号 |
| hash | string | 哈希 |
| title | string | 标题 |
| prefix | string | 欢迎语 |
| suffix | string | 结束语 |
| pages | array[page] | 问卷内容页列表,参考下方单页内容 |
| page_count | integer | 页数 |
| topic_count | integer | 问题数 |
| startTime | integer | 回收开始时间 |
| endTime | integer | 回收结束时间 |
| createTime | integer | 创建时间 |
| updateTime | integer | 更新时间 |
| state | integer | 状态 |
| template_id | integer | 使用的模板ID,对应 template_system 表 |
单页内容
| 参数名 | 类型 | 描述 |
|---|---|---|
| id | string | 单页标识 |
| index | string | 序号 |
| questions | array[question] | 问题列表,参考下方题目内容 |
题目内容
| 参数名 | 类型 | 描述 |
|---|---|---|
| question.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) |
选项内容
| 参数名 | 类型 | 描述 |
|---|---|---|
| option.id | string | 选项 ID |
| option.goto | object | 选择选项后跳转题目 |
| option.display | object | 选择选项后显示题目 |
| option.noRandom | bool | 题目设置选项随机的时候,固定当前选项位置 |
| option.text | string | 选项文案 |
| option.exclusive | bool | 当题目为多选题的时候,设置当前选项为互斥选项 |
基本设置
| 参数名 | 类型 | 描述 |
|---|---|---|
| show_stat | bool | 是否展示统计结果 |
| pc | bool | true:文本模式;false:高级模式 |
| prev | bool | 是否允许回到上一页 |
| titleIndex | bool | 是否显示题目序号 |
| login_check | bool | 是否开启登陆验证 |
| answer_count | integer | 允许回答次数 |
| whitelist_enable | bool | 是否开启白名单 |
| whitelist_type | integer | 白名单类型 |
| redirect_url | string | 答题后跳转链接 |
| is_redirect_url_verified | bool | 跳转链接是否已验证安全 |
| webhook_url | string | 答题后推送数据的地址 |
| survey_type | integer | 问卷类型 0:普通问卷 1:测评问卷 |
| survey_rules | object | 旧版答题规则,有一部分由questions.goto承载 |
| survey_dsl | object | 自定义逻辑 |
| questions_random | array[string] | 数组,题目随机顺序 |
| is_allow_update_answer | bool | 是否允许修改答案 |
| is_enabled_location | bool | 是否获取用户位置信息 |
| is_access_survey | bool | 是否为测评问卷 |
皮肤/样式设置
| 参数名 | 类型 | 描述 |
|---|---|---|
| thumb_url | array | 封面图地址 |
| styles | object | 旧版皮肤 |
| skin | object | 新版皮肤 |
| hide_tencent_relevant_allowed | bool | 是否允许去腾讯化 |
| hide_tencent_relevant | bool | 是否设置去腾讯化 |
| custom_copyright | string | 自定义版权信息 |
| is_hide_advertisement | bool | 是否隐藏广告 |
答题奖励设置
| 参数名 | 类型 | 描述 |
|---|---|---|
| reward.status | integer | |
| default_reward | bool | 是否使用系统奖品库 |
| reward | object | 是否设置自定义奖品库 |
| reward.name | string | |
| reward.contact | string | |
| reward.endDateTime | string | |
| reward.deliverMethod | string | |
| reward.lotteryMethod | string | |
| reward.winPrizeProbability | string | |
| reward.reward_type | integer | |
| reward.reward_cnt | integer | |
| reward.reward_flag | integer | |
| reward.list | array[object] | |
| reward.list[_].id | integer | |
| reward.list[_].name | string | |
| reward.list[_].value | string | |
| reward.list[_].count | integer | |
| is_enabled_luckymoney | bool | 是否设置红包(普通红包或样本库红包) |
| is_enabled_common_luckymoney | bool | 是否为普通红包 |
| is_enabled_data_cleaner | bool | 是否开启智能清洗(红包相关) |
| is_enabled_samples | bool | 是否开启回答小组 |
| has_ongoing_groups | bool | 是否有未结束的小组 |
打卡/健康码/报名签到设置
| 参数名 | 类型 | 描述 |
|---|---|---|
| is_enabled_attendance | bool | 是否开启打卡 |
| daily_attendance_count | integer | 每日打卡次数限制 |
| is_enabled_attendance_cert | bool | 是否开启健康码 |
| is_allow_get_healthy_status | bool | 是否允许获取健康码 |
| is_allowed_enable_attendance_cert | bool | 是否允许开启健康码 |
| is_register | bool | 是否开启报名签到 |
其他
编辑者视角参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| 问卷管理员设置 | - | - |
| survey_user | object | 当前权限级别 |
| survey_user.level | integer | 当前权限级别 |
| survey_user.level_str | string | 当前权限级别 |
| survey_user.granted_query | object | 当前权限级别 |
| survey_user.granted_search | object | 当前权限级别 |
| create_owner | integer | 问卷创建者ID |
| admin_enable | bool | 是否是协管员 |
| answer_alert | object | 回收提醒 |
| answer_notice | bool | 提醒回答 |
| checkin_started_at | object | 开始签到时间 |
| checkin_expired_at | object | 签到截止时间 |
| checkin_qrcode_uri | string | 签到二维码地址 |
| is_checkin_approved_only | bool | 是否仅通过的人才可以签到 |
| is_remind_before_checkin | bool | 签到前提醒 |
回答者视角参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| timestamp | integer | 默认当前时间用于计算答题时间 |
| recycle | integer | 回收量,与 show_stat 相关 |
| validCount | integer | 运算量,与 show_stat 相关 |
| is_sample_user | bool | 是否为目标样本 |
| sample_reward_type | integer | 奖励类型 |
| sample_reward_amount | integer | 奖励价值 |
废弃参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| callback | string | |
| ip | bool | 1个ip是否只能回答一次 |
| lang | string | 语言默认"zh" |
| purpose | string | 备注信息 |
| cache | string | 是否命中缓存 |
| previewURL | string | 问卷预览链接 |
| url | string | 问卷链接 |
| login | bool | 是否登录 |
| is_current_user_weiyun_binding | bool | 用户是否已经绑定微云 |
| is_enabled_weiyun | bool | 是否开启微云 |
| weiyun_user_id | integer | 微云绑定的用户ID |
| credit_level | integer | 信用等级 |
响应示例
- 请求成功
{
"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,
"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 | 获取数据错误 |