Skip to main content
Version: latest

添加回答内容

接口概述

  • 功能:添加回答内容
  • 请求方式: POST
  • 请求地址:/api/surveys/{survey_id}/answers

请求参数

基本参数

参数名类型参数位置描述示例值
survey_idintegeruri问卷ID292192
respondent_idintegerbody回答者ID60000208435
answerobjectbody回答内容
answer.survey_typeintegerbody问卷类型0普通问卷,1测评问卷
answer.jsonLoadTimeintegerbody答题总时长(秒)10
answer.timeintegerbody答题结束时间戳1625835392
answer.uastringbody浏览器 user-agentMozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
answer.referrerstringbody答题页面的来源地址https://wj.qq.com/deliver.html?sid=292194
answer.uidstringbody随机生成的用户标识传空字符串即可
answer.sidstringbody随机生成的答题标识传空字符串即可
answer.openidstringbody自定义字段,从答题页链接的query参数获得,入库后有单独字段保存,支持统计、导出abcdefg
answer.latitudestringbody用户定位坐标维度"22.527735929411932"
answer.longitudestringbody用户定位坐标经度"113.93811254994733"
answer.is_updateboolbody是否修改上次答案,是则数据库不更新数据,仅查找该用户的上一次提交进行修改false
answer.pagesarray[object]body回答内容页列表,参考下方回答单页内容

回答单页内容

参数名类型描述
idstring单页标识,与问卷详情的page.id 对应
questionsarray[object]回答题目列表,参考下方回答题目内容

回答题目内容

备注:只传已回答的题目。

参数名类型描述
idstring题目ID
typestring题目类型
textstring文本题填写内容
optionsarray[object]单选、多选选项列表,参考下方回答选项内容
groupsarray[object]矩阵题专用
groups[_].idstring矩阵题某一行的问题ID
groups[_].optionsarray[object]矩阵题某一行的选项列表,参考下方回答选项内容
blanksarray[object]填空题填写内容,一道题可能有多个填空
blanks[_].idstring填空题ID
blanks[_].valuestring填空题填写内容文本
id_listarray[string]联动题选中项ID [第一级选项ID,第二级选项ID,第三级选项ID]
text_listarray[string]联动题选中项内容 [第一级选项文本,第二级选项文本,第三级选项文本]
file_name_srcstring上传文件的原始名称
file_name_dststring上传文件的结果名称,提前调用文件上传接口返回的结果

回答选项内容

备注:只传已选中的选项。

参数名类型描述
idstring选项ID
checkedint是否选中,1为选中
textstring选项文本内容
sort_noint排序题选项顺序,由低到高

题目类型

type 值类型
radio单选题
select下拉题
checkbox多选题
text单行文本题
textarea多行文本题
star量表题
matrix_radio矩阵单选题
matrix_checkbox矩阵多选题
matrix_star矩阵量表题
sort排序题
chained_selects联动题
upload附件题
text_multiple填空题

请求示例

POST https://open.wj.qq.com/api/surveys/292192/answers

{
"respondent_id": 60000208435,
"answer": {
"id": "292185",
"survey_type": 0,
"jsonLoadTime": 39,
"time": 1625821222,
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
"referrer": "https://wj.qq.com/mine.html",
"uid": "391890fe-1256-4b0d-8a14-735e0270702f",
"sid": "a4b759a5-db54-4260-af89-a71e537e21f3",
"openid": "",
"pages": [{
"id": "1",
"questions": [{
"id": "q-1-leFK",
"type": "radio",
"options": [{
"id": "o-100-ABCD",
"checked": 1,
"text": "<p>选项A</p>\n"
}]
}, {
"id": "q-2-hijH",
"type": "select",
"options": [{
"id": "o-100-ABCD",
"checked": 1,
"text": "选项A"
}]
}, {
"id": "q-3-ebel",
"type": "checkbox",
"options": [{
"id": "o-100-ABCD",
"checked": 1,
"text": "<p>选项A</p>\n"
}]
}, {
"id": "q-4-nSBr",
"type": "text",
"text": "123"
}, {
"id": "q-5-oo6i",
"type": "textarea",
"text": "234"
}, {
"id": "q-6-3TOZ",
"type": "star",
"text": "12"
}, {
"id": "q-7-zkcT",
"type": "matrix_radio",
"groups": [{
"id": "g-1-ABCD",
"options": [{
"id": "o-100-ABCD",
"checked": 1,
"text": "<p>选项1</p>\n"
}]
}, {
"id": "g-2-EFGH",
"options": [{
"id": "o-101-EFGH",
"checked": 1,
"text": "<p>选项2</p>\n"
}]
}]
}, {
"id": "q-8-psoY",
"type": "matrix_checkbox",
"groups": [{
"id": "g-1-ABCD",
"options": [{
"id": "o-100-ABCD",
"checked": 1,
"text": "<p>选项1</p>\n"
}]
}, {
"id": "g-2-EFGH",
"options": [{
"id": "o-101-EFGH",
"checked": 1,
"text": "<p>选项2</p>\n"
}]
}]
}, {
"id": "q-9-vsfe",
"type": "matrix_star",
"groups": [{
"id": "g-1-ABCD",
"text": "4"
}, {
"id": "g-2-EFGH",
"text": "3"
}]
}, {
"id": "q-10-qqJa",
"type": "sort",
"options": [{
"id": "o-101-EFGH",
"sort_no": 1
}, {
"id": "o-100-ABCD",
"sort_no": 2
}]
}, {
"id": "q-11-8Doi",
"type": "chained_selects",
"id_list": ["9-R8", "13-0y", "15-ZP"],
"text_list": ["广西", "阳朔", "2区"]
}, {
"id": "q-12-910K",
"type": "upload",
"file_name_src": "四庫史部97.txt",
"file_name_dst": "292185_0_570d6e4e5f36954ec1baa2b0a8d21135.txt"
}, {
"id": "q-14-qF3P",
"type": "text_multiple",
"blanks": [{
"id": "fillblank-qVzp",
"value": "1234"
}]
}]
}],
"latitude": "",
"longitude": "",
"is_update": false
}
}

响应示例