Get Survey Details
API Overview
- Function: Get survey details
- Request Method: GET
- Request URL: /api/surveys/{survey_id}/legacy?appid={appid}&access_token={access_token}
Request Parameters
Parameter Name | Type | Location | Description | Example |
---|---|---|---|---|
survey_id | integer | uri | Survey ID | 292192 |
Response Parameters
Basic Content
Parameter Name | Type | Description |
---|---|---|
id | integer | ID |
hash | string | Hash |
scene | string | Scene, refer to Survey Scenes below |
title | string | Title |
prefix | string | Welcome message |
suffix | string | End message |
pages | array[page] | Survey page list, refer to Page Content below |
page_count | integer | Number of pages |
topic_count | integer | Number of questions |
startTime | integer | [Deprecated] Collection start time |
endTime | integer | [Deprecated] Collection end time |
started_at | string | Collection start time e.g. 2024-06-01 00:00:00 |
end_at | string | Collection end time e.g. 2024-07-01 00:00:00 |
createTime | integer | Creation time |
updateTime | integer | Update time |
state | integer | Status, 0:Draft, 2:Collecting, 3:Paused |
template_id | integer | Template ID used, corresponds to template_system table |
creator_user_id | integer | Survey creator's user ID |
Survey Scenes
Scene Name | Value | Description |
---|---|---|
Legacy Normal Survey | 0 | Deprecated, do not use |
Survey | 1 | |
Legacy Exam Survey | 2 | Deprecated, do not use |
Online Exam | 3 | |
Information Report | 4 | |
360 Assessment | 5 | |
Online Evaluation | 6 | |
Registration & Check-in | 7 | |
Vote & Selection | 8 | |
Chain Sign-in | 9 |
Survey Status
Status Name | Value |
---|---|
Draft | 0 |
Collecting | 2 |
Paused | 3 |
Page Content
Parameter Name | Type | Description |
---|---|---|
id | string | Page identifier |
index | string | Sequence number |
questions | array[question] | Question list, refer to Question Content below |
Question Content
Parameter Name | Type | Description |
---|---|---|
question.type | string | Question type, refer to Question Types |
question.sub_type | string | Question subtype, refer to Question Subtypes |
question.title | string | Question title |
question.description | string | Question note |
question.required | bool | Whether required |
question.goto | object | Jump to question after answering |
question.blank_setting | array | "Other" fill-in settings in options |
question.hidden | bool | Whether hidden |
question.prefill | bool | Pre-filled content |
question.random | bool | Whether randomized |
question.maxRow | object | Number of options per row for multiple choice |
question.refer | object | Referenced question number |
question.options | array[object] | Option list, refer to Option Content |
question.assess | object | Assessment question |
question.id | string | Question ID |
question.real_index | integer | |
question.index | integer | Question number |
question.maxlength | object | Maximum selections for multiple choice, maximum characters for single/multi-line text |
question.validate | string | Text validation rules, including `('number' |
question.rows | object | Number of rows for multi-line text |
question.cols | object | Number of columns for multi-line text |
question.starShow | string | Scale type |
question.otherStr | string | Deprecated field |
question.isOther | bool | Deprecated field |
question.starBeginNum | integer | Scale starting value |
question.starNum | object | Scale range, 2-10 |
question.starType | object | Scale type |
question.revertSort | object | Whether to reverse sort, values default from small to large |
question.starShowCustomStart | string | Scale start text |
question.starShowCustomEnd | string | Scale end text |
question.starOptions | array[int] | |
question.subTitles | array[object] | Matrix question sub-question list |
question.subTitles[_].id | string | Matrix question sub-question ID |
question.subTitles[_].text | string | Matrix question sub-question text |
question.levels | array[string] | Cascade question level titles |
question.groups | array[object] | Cascade question list (nested) [Option ID, Option text, Sub-option list] |
question.file_type_limit | array[string] | Allowed file types |
question.file_size_limit | object | Allowed file size (KB) |
Question Types
Question types are divided into type
and sub_type
. When sub_type
exists, it takes precedence over type
.
type
Question Type | Value |
---|---|
Single Choice | 'radio' |
Multiple Choice | 'checkbox' |
Dropdown | 'select' |
Single Line Text | 'text' |
Multi-line Text | 'textarea' |
Scale/NPS | 'star' |
Sorting | 'sort' |
Matrix Single Choice | 'matrix_radio' |
Matrix Multiple Choice | 'matrix_checkbox' |
Matrix Scale | 'matrix_star' |
Matrix Fill-in | 'matrix_blank' |
Cascade | 'chained_selects' |
Image/File | 'upload' |
Text Description | 'description' |
Fill-in (Legacy) | 'text_multiple' |
Fill-in | 'blanks' |
Date/Time | 'datetime' |
Handwritten Signature | 'signature' |
Geographic Location | 'address' |
Phone Number | 'phone' |
Auto-increment Table | 'sheet' |
sub_type
Question Type | Value | Applicable Scene |
---|---|---|
Default | 0 | Exam scene |
Single Choice | 1 | Exam scene |
Multiple Choice | 2 | Exam scene |
Variable Choice | 3 | Exam scene |
True/False | 4 | Exam scene |
Multiple Fill-in | 5 | Exam scene |
Essay | 6 | Exam scene |
Assessment Single Choice | 7 | 360 scene |
Matrix Assessment Single Choice | 8 | 360 scene |
Evaluation Single Choice | 9 | Evaluation scene |
Evaluation Multiple Choice | 10 | Evaluation scene |
Custom Scale | 11 | Evaluation scene |
Scoring | 12 | All scenes |
Matrix Scoring | 13 | All scenes |
Option Content
Parameter Name | Type | Description |
---|---|---|
option.id | string | Option ID |
option.goto | object | Jump to question after selecting this option |
option.display | object | Show question after selecting this option |
option.noRandom | bool | Fix current option position when question has random options |
option.text | string | Option text |
option.exclusive | bool | Set current option as mutually exclusive for multiple choice questions |
Basic Settings
Parameter Name | Type | Description |
---|---|---|
prev | bool | Whether to allow returning to previous page |
titleIndex | bool | Whether to display question numbers |
login_check | bool | Whether to enable login verification |
answer_count | integer | Allowed number of responses |
whitelist_enable | bool | Whether to enable whitelist |
redirect_url | string | Redirect URL after submission |
webhook_url | string | URL for data push after submission |
survey_type | integer | Survey type 0: Normal survey 1: Assessment survey |
questions_random | array[string] | Array for random question order |
is_allow_update_answer | bool | Whether to allow answer modification |
is_enabled_location | bool | Whether to get user location information |
is_access_survey | bool | Whether it is an assessment survey |
Response Examples
- Successful Request
{
"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"
}
- Failed Request
{
"code": "InvalidArgument",
"error": {
"type": "invalid_argument",
},
"data": {},
"request_id": "ddec96d2-165e-4f3e-8a64-2057db116983"
}
Error Codes
error.type Error Code | Description |
---|---|
invalid_auth_status | Invalid permission type |
claim_error | Permission verification error |
get_survey_error | Data retrieval error |