Skip to main content

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 NameTypeLocationDescriptionExample
survey_idintegeruriSurvey ID292192

Response Parameters

Basic Content

Parameter NameTypeDescription
idintegerID
hashstringHash
scenestringScene, refer to Survey Scenes below
titlestringTitle
prefixstringWelcome message
suffixstringEnd message
pagesarray[page]Survey page list, refer to Page Content below
page_countintegerNumber of pages
topic_countintegerNumber of questions
startTimeinteger[Deprecated] Collection start time
endTimeinteger[Deprecated] Collection end time
started_atstringCollection start time e.g. 2024-06-01 00:00:00
end_atstringCollection end time e.g. 2024-07-01 00:00:00
createTimeintegerCreation time
updateTimeintegerUpdate time
stateintegerStatus, 0:Draft, 2:Collecting, 3:Paused
template_idintegerTemplate ID used, corresponds to template_system table
creator_user_idintegerSurvey creator's user ID

Survey Scenes

Scene NameValueDescription
Legacy Normal Survey0Deprecated, do not use
Survey1
Legacy Exam Survey2Deprecated, do not use
Online Exam3
Information Report4
360 Assessment5
Online Evaluation6
Registration & Check-in7
Vote & Selection8
Chain Sign-in9

Survey Status

Status NameValue
Draft0
Collecting2
Paused3

Page Content

Parameter NameTypeDescription
idstringPage identifier
indexstringSequence number
questionsarray[question]Question list, refer to Question Content below

Question Content

Parameter NameTypeDescription
question.typestringQuestion type, refer to Question Types
question.sub_typestringQuestion subtype, refer to Question Subtypes
question.titlestringQuestion title
question.descriptionstringQuestion note
question.requiredboolWhether required
question.gotoobjectJump to question after answering
question.blank_settingarray"Other" fill-in settings in options
question.hiddenboolWhether hidden
question.prefillboolPre-filled content
question.randomboolWhether randomized
question.maxRowobjectNumber of options per row for multiple choice
question.referobjectReferenced question number
question.optionsarray[object]Option list, refer to Option Content
question.assessobjectAssessment question
question.idstringQuestion ID
question.real_indexinteger
question.indexintegerQuestion number
question.maxlengthobjectMaximum selections for multiple choice, maximum characters for single/multi-line text
question.validatestringText validation rules, including `('number'
question.rowsobjectNumber of rows for multi-line text
question.colsobjectNumber of columns for multi-line text
question.starShowstringScale type
question.otherStrstringDeprecated field
question.isOtherboolDeprecated field
question.starBeginNumintegerScale starting value
question.starNumobjectScale range, 2-10
question.starTypeobjectScale type
question.revertSortobjectWhether to reverse sort, values default from small to large
question.starShowCustomStartstringScale start text
question.starShowCustomEndstringScale end text
question.starOptionsarray[int]
question.subTitlesarray[object]Matrix question sub-question list
question.subTitles[_].idstringMatrix question sub-question ID
question.subTitles[_].textstringMatrix question sub-question text
question.levelsarray[string]Cascade question level titles
question.groupsarray[object]Cascade question list (nested) [Option ID, Option text, Sub-option list]
question.file_type_limitarray[string]Allowed file types
question.file_size_limitobjectAllowed 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 TypeValue
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 TypeValueApplicable Scene
Default0Exam scene
Single Choice1Exam scene
Multiple Choice2Exam scene
Variable Choice3Exam scene
True/False4Exam scene
Multiple Fill-in5Exam scene
Essay6Exam scene
Assessment Single Choice7360 scene
Matrix Assessment Single Choice8360 scene
Evaluation Single Choice9Evaluation scene
Evaluation Multiple Choice10Evaluation scene
Custom Scale11Evaluation scene
Scoring12All scenes
Matrix Scoring13All scenes

Option Content

Parameter NameTypeDescription
option.idstringOption ID
option.gotoobjectJump to question after selecting this option
option.displayobjectShow question after selecting this option
option.noRandomboolFix current option position when question has random options
option.textstringOption text
option.exclusiveboolSet current option as mutually exclusive for multiple choice questions

Basic Settings

Parameter NameTypeDescription
prevboolWhether to allow returning to previous page
titleIndexboolWhether to display question numbers
login_checkboolWhether to enable login verification
answer_countintegerAllowed number of responses
whitelist_enableboolWhether to enable whitelist
redirect_urlstringRedirect URL after submission
webhook_urlstringURL for data push after submission
survey_typeintegerSurvey type 0: Normal survey 1: Assessment survey
questions_randomarray[string]Array for random question order
is_allow_update_answerboolWhether to allow answer modification
is_enabled_locationboolWhether to get user location information
is_access_surveyboolWhether 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 CodeDescription
invalid_auth_statusInvalid permission type
claim_errorPermission verification error
get_survey_errorData retrieval error