查詢觀眾回答頻道問卷詳情
更新時間:2022-09-02 18:08:07
介面URL
https://api.polyv.net/live/v3/channel/questionnaire/detail-by-viewer
介面說明
1、接口用于查询观众回答频道问卷详情
2、问卷ID可以从获取频道问卷列表中获取
3、接口支持https
回傳結果格式
JSON
請求方式
GET
請求參數
| 參數名 | 必填 | 類型 | 說明 |
|---|---|---|---|
| appId | 是 | string | 從API設定中取得,在直播系統登記的appId |
| timestamp | 是 | long | 目前13位毫秒級時間戳,3分鐘內有效 |
| sign | 是 | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在客戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| channelId | 是 | int | 頻道號 |
| questionnaireId | 是 | string | 問卷ID |
| viewerId | 是 | string | 觀眾ID |
回應成功JSON範例:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"questionnaireId": "fefg598lfj",
"customQuestionnaireId": "ddddxxx222",
"channelId": 108888,
"userId": "edvf2fpec9",
"name": "测试问卷_1564105496583",
"status": "forbidden",
"createdTime": 1564105498000,
"lastModified": 1564105498000,
"endTime": 1564105580000,
"questions": [
{
"questionId": "3839e04e78",
"channelId": 108888,
"userId": "edvf2fpec9",
"name": "您觉得课程怎么样",
"type": "C",
"option1": "好",
"option2": "很好",
"option3": "非常好",
"option4": "超级好",
"option5": "以上都对",
"createdTime": 1564105498000,
"lastModified": 1564105498000,
"answer": "",
"note": null,
"templateId": null,
"status": "draft",
"times": 0,
"tips1": null,
"tips2": null,
"tips3": null,
"tips4": null,
"tips5": null,
"required": "Y",
"scoreEnabled": "N",
"option6": "",
"option7": "",
"option8": "",
"option9": "",
"option10": "",
"score": null,
"itemType": 0,
"viewerId": "xsxxxxx",
"param4": "",
"param5": "",
"nickname": "aaa",
"recordAnswer": "C"
},
{
"questionId": "c908c81e80",
"channelId": 108888,
"userId": "edvf2fpec9",
"name": "今后还会不会来",
"type": "R",
"option1": "会",
"option2": "不会",
"option3": "",
"option4": "",
"option5": "",
"createdTime": 1564105498000,
"lastModified": 1564105498000,
"answer": "",
"note": null,
"templateId": null,
"status": "draft",
"times": 0,
"tips1": null,
"tips2": null,
"tips3": null,
"tips4": null,
"tips5": null,
"required": "Y",
"scoreEnabled": "N",
"option6": "",
"option7": "",
"option8": "",
"option9": "",
"option10": "",
"score": null,
"itemType": 0,
"viewerId": "xsxxxxx",
"param4": "",
"param5": "",
"nickname": "aaa",
"recordAnswer": "C"
}
]
}
}
回應失敗JSON範例:
未輸入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正確
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
時間戳錯誤
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
簽名錯誤
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
問卷ID不存在
{
"code": 400,
"data": "",
"message": "questionnaire is not exist",
"status": "error"
}
欄位說明
| 參數名 | 說明 |
|---|---|
| code | 回應代碼,成功為200,失敗為400,簽名錯誤為403,異常錯誤500 |
| status | 成功為success,失敗為error |
| message | 錯誤時的錯誤提示訊息 |
| questionnaireId | 問卷ID |
| customQuestionnaireId | 使用者自訂問卷ID |
| channelId | 頻道ID |
| userId | 使用者ID |
| name | 問卷名稱 |
| status | 問卷狀態 |
| createdTime | 問卷建立時間 |
| endTime | 停止問卷時間 |
| questions | 問卷問題列表 |
問卷問題模型類別question
| 參數名 | 說明 |
|---|---|
| questionId | 問題ID |
| name | 問題題目 |
| type | 問題類型,取值:R 單選;C 多選;S 評星題;Q 問答 |
| option1~10 | 選項A~G 的內容 |
| createdTime | 建立時間 |
| lastModified | 最後修改時間 |
| scoreEnabled | 是否計分,取值Y、N |
| score | 題目分值 |
| required | 是否必填,取值Y、N |
| answer | 問題答案 |
| recordAnswer | 問題回答答案 |
| viewerId | 觀眾ID |
| nickname | 觀眾暱稱 |
| param4 | 自訂參數 |
| param5 | 自訂參數 |
Java請求範例
public static void test() {
String url = "https://api.polyv.net/live/v3/channel/questionnaire/detail-by-viewer";
// 用户对应的appId和加密串
String appId = "xxxxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
int channelId = 10001;
String questionnaireId = "xxxxx";
String viewerId = "xxxxx";
Map<String, String> params = new HashMap<>();
params.put("channelId", String.valueOf(channelId));
params.put("questionnaireId", questionnaireId);
params.put("viewerId", viewerId);
PolyvTool.setLiveSign(params, appId, appSecret);
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance()
.sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
System.out.println(content);
}
