Query Channel Questionnaire Questions and Results
Updated: 2022-09-02 18:08:07
Interface Description
1、查询频道问卷题目与结果
2、问卷ID可以从获取频道问卷列表中获取
3、接口支持https协议
Interface URL
http://api.polyv.net/live/v3/channel/questionnaire/detail
Request Method
GET
Interface Constraints
- The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details: Get Secret Key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never be saved or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See details: Signature Generation Rules |
| channelId | true | String | Channel ID |
| questionnaireId | true | String | Questionnaire ID, obtained from Query Channel Questionnaire List |
Example
https://api.polyv.net/live/v3/channel/questionnaire/detail?appId=frlr1zazn3&sign=21B0DC009E318AA78636A7CE9C622056&questionnaireId=fwndt7vq4x&channelId=1965681×tamp=1621845043008
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure See details: Global Error Description |
| status | String | Response status text |
| message | String | Response description message, provides error details when code is 400 or 500 |
| data | Object | Questionnaire basic information on successful response See details: data field description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| questionnaireId | String | Questionnaire ID |
| customQuestionnaireId | String | User-defined questionnaire ID |
| channelId | String | Channel ID |
| userId | String | User ID |
| name | String | Questionnaire name |
| status | String | Questionnaire status draft: Draft send: Sent delete: Deleted |
| createdTime | Long | Questionnaire creation time |
| endTime | Long | Questionnaire end time |
| questions | Array | List of questionnaire questions See details: questions field description |
questions Field Description
| Parameter | Type | Description |
|---|---|---|
| questionId | String | Question ID |
| channelId | String | Channel ID |
| userId | String | User ID |
| name | String | Question title |
| type | String | Question type R: Single choice C: Multiple choice S: Star rating Q: Q&A |
| option 1~10 | String | Content of options A~J |
| createdTime | String | Creation time |
| lastModified | String | Last modification time |
| answer | String | Question answer |
| note | String | Remark |
| templateId | String | Template ID |
| status | String | Questionnaire status draft: Draft send: Sent delete: Deleted |
| times | Integer | Number of times the questionnaire was initiated |
| tips1 1~5 | String | Corresponding tips for the question |
| required | String | Whether mandatory Y: Mandatory N: Optional |
| scoreEnabled | String | Whether scoring is enabled Y: Scored N: Not scored |
| score | String | Question score |
| itemType | Integer | Answer type 1: Q&A 0: Answer sheet |
Java Request Example
For quick integration of the basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. HttpUtil.java and LiveSignUtil.java from the test cases are included in the downloaded file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(LiveInteractionTest.class);
/**
* 查询频道问卷题目与结果
* @throws IOException
*/
@Test
public void testGetQuestionnaireDetail() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String channelId = "1965681";
String questionnaireId = "fwndt7vq4x";
String url = "http://api.polyv.net/live/v3/channel/questionnaire/detail";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("questionnaireId",questionnaireId);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url,requestMap);
log.info("测试查询频道问卷题目与结果接口返回值:{}",response);
//do somethings
}
Response Example
For system global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": {
"questionnaireId": "fwndt7vq4x",
"channelId": 1965681,
"userId": "1b448be323",
"name": "测试试卷,明天会更好调查2 (1175)",
"status": "saved",
"createdTime": 1615507307000,
"lastModified": 1615507307000,
"endTime": null,
"customQuestionnaireId": "30231311ed334a7f80e4db520b3bec99",
"questions": [{
"questionId": "4bb657cc5897451ea4705a9bb843e16c",
"channelId": 1965681,
"userId": "1b448be323",
"name": "您的兴趣爱好?",
"type": "C",
"option1": "篮球",
"option2": "足球",
"option3": "排球",
"option4": "跑步",
"option5": "羽毛球",
"createdTime": 1615507307000,
"lastModified": 1615507307000,
"answer": "a",
"note": null,
"templateId": null,
"status": "draft",
"times": 0,
"tips1": null,
"tips2": null,
"tips3": null,
"tips4": null,
"tips5": null,
"required": "Y",
"scoreEnabled": "Y",
"option6": null,
"option7": null,
"option8": null,
"option9": null,
"option10": null,
"score": 20,
"itemType": 0,
"option11": null,
"option12": null,
"option13": null,
"option14": null,
"option15": null
}, {
"questionId": "b5b33c428cfd488eb8f4c5991e4e9aff",
"channelId": 1965681,
"userId": "1b448be323",
"name": "您的性别",
"type": "R",
"option1": "M",
"option2": "W",
"option3": null,
"option4": null,
"option5": null,
"createdTime": 1615507307000,
"lastModified": 1615507307000,
"answer": "",
"note": null,
"templateId": null,
"status": "draft",
"times": 0,
"tips1": null,
"tips2": null,
"tips3": null,
"tips4": null,
"tips5": null,
"required": "Y",
"scoreEnabled": "N",
"option6": null,
"option7": null,
"option8": null,
"option9": null,
"option10": null,
"score": null,
"itemType": 0,
"option11": null,
"option12": null,
"option13": null,
"option14": null,
"option15": null
}, {
"questionId": "cc4b8c4c44d346bcab4bb47e3dca275d",
"channelId": 1965681,
"userId": "1b448be323",
"name": "您的职务?",
"type": "Q",
"option1": "",
"option2": null,
"option3": null,
"option4": null,
"option5": null,
"createdTime": 1615507307000,
"lastModified": 1615507307000,
"answer": "",
"note": null,
"templateId": null,
"status": "draft",
"times": 0,
"tips1": null,
"tips2": null,
"tips3": null,
"tips4": null,
"tips5": null,
"required": "Y",
"scoreEnabled": "N",
"option6": null,
"option7": null,
"option8": null,
"option9": null,
"option10": null,
"score": null,
"itemType": 0,
"option11": null,
"option12": null,
"option13": null,
"option14": null,
"option15": null
}]
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
