Polyv Help Center

Help Center

questionnaireService

Updated: 2025-09-11 15:18:09

1. Query Channel Survey List

Description

接口用于获取频道的问卷列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/questionnaire/list

Call Constraints

  1. The API call is subject to rate limits. For details, see here. For common call exceptions, see here.

Unit Testing

    @Test
    public void testGetQuestionnaireListInfo() throws Exception, NoSuchAlgorithmException {
        LiveQuestionnaireListRequest liveQuestionnaireListRequest = new LiveQuestionnaireListRequest();
        LiveQuestionnaireListResponse liveQuestionnaireListResponse = null;
        try {
            String channelId = super.createChannel();
            liveQuestionnaireListRequest.setChannelId(channelId);
            liveQuestionnaireListResponse = new LiveQuestionnaireServiceImpl().getQuestionnaireListInfo(
                    liveQuestionnaireListRequest);
            Assert.assertNotNull(liveQuestionnaireListResponse);
            if (liveQuestionnaireListResponse != null) {
                //to do something ......
                log.debug("测试查询频道问卷列表成功{}", JSON.toJSONString(liveQuestionnaireListResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Testing Instructions

  1. If the request is correct, a LiveQuestionnaireListResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
startTime false Date Start time of the records to query
endTime false Date End time of the records to query
currentPage false Integer Page number, defaults to 1 [corresponds to the page field in the API documentation]
pageSize false Integer Number of data entries displayed per page, defaults to 20 entries per page
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings)

Return Object Description

Parameter Type Description
contents Array List of survey data [See QuestionDetail Parameter Description for details]
pageSize Integer Number of data items displayed per page, default is 20 items per page
currentPage Integer Current page [Corresponds to the pageNumber field in the API documentation]
totalItems Integer Total number of records
totalPage Integer Total number of pages [Corresponds to the totalPages field in the API documentation]
QuestionDetail Parameter Description
Parameter Name Type Description
questionnaireId String Questionnaire ID
channelId String Channel ID
userId String POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings)
questionnaireTitle String Questionnaire title [corresponds to the name field in the API documentation]
status String Questionnaire status, values: saved, published, forbidden (questionnaire submission completed)
createdTime Date Questionnaire creation time
lastModified Date Last modification time of the questionnaire
endTime Date Time to stop accepting questionnaire submissions
customQuestionnaireId String User-defined questionnaire ID






2. Query Channel Survey Details

Description

1、接口用于查询频道问卷详情
2、问卷ID 可以从获取频道问卷列表中获取
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/questionnaire/detail

Call Constraints

  1. The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testGetQuestionnaireDetailInfo() throws Exception, NoSuchAlgorithmException {
        LiveQuestionnaireDetailRequest liveQuestionnaireDetailRequest = new LiveQuestionnaireDetailRequest();
        LiveQuestionnaireDetailResponse liveQuestionnaireDetailResponse = null;
        try {
            String channelId = super.createChannel();
            //获取详情
            liveQuestionnaireDetailRequest.setChannelId(channelId).setQuestionnaireId("fs9skpv22f");
            liveQuestionnaireDetailResponse = new LiveQuestionnaireServiceImpl().getQuestionnaireDetailInfo(
                    liveQuestionnaireDetailRequest);
            Assert.assertNotNull(liveQuestionnaireDetailResponse);
            if (liveQuestionnaireDetailResponse != null) {
                //to do something ......
                log.debug("测试查询频道问卷详情成功{}", JSON.toJSONString(liveQuestionnaireDetailResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Testing Instructions

  1. If the request is correct, return a LiveQuestionnaireDetailResponse object, based on which the B-side handles business logic.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
questionnaireId true String Questionnaire ID
appId false String POLYV user APP_ID. This parameter is required when calling with multiple accounts (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET. This parameter is required when calling with multiple accounts (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

Parameter Name Type Description
questionnaireId String Questionnaire ID
customQuestionnaireId String User-defined questionnaire ID
channelId String Channel ID
userId String POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings)
questionnaireTitle String Questionnaire title [corresponds to the name field in the API documentation]
status String Questionnaire status: draft (draft), send (sent), delete (deleted)
createdTime Date Questionnaire creation time
endTime Date Questionnaire end time
questions Array List of questionnaire questions [see QuestionDetail parameter description for details]
QuestionDetail Parameter Description
Parameter Type Description
questionId String Question ID
name String Question title
type String Question type. Values: R - Single choice; C - Multiple choice; S - Star rating; Q - Q&A
option1 String Option A
option2 String Option B
option3 String Option C
option4 String Option D
option5 String Option E
option6 String Option F
option7 String Option G
option8 String Option H
option9 String Option I
option10 String Option J
createdTime Date Creation time
lastModified Date Last modified time
scoreEnabled String Whether scoring is enabled. Values: Y - Scored, N - Not scored. Default: N
score Integer Question score
required String Whether the question is mandatory. Values: Y - Required, N - Optional. Default: N
answer String Question answer






3. Query Channel Survey Results

Description

接口用于查询直播问卷的答题结果及统计
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/questionnaire/answer-records

Call Constraints

  1. The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testGetQuestionnaireResultInfo() throws Exception, NoSuchAlgorithmException {
        LiveQuestionnaireResultRequest liveQuestionnaireResultRequest = new LiveQuestionnaireResultRequest();
        List<LiveQuestionnaireResultResponse> liveQuestionnaireResultResponse = null;
        try {
            String channelId = super.createChannel();
            liveQuestionnaireResultRequest.setChannelId(channelId);
            liveQuestionnaireResultRequest.setStartDate(getDate(2020, 10, 01)).setEndDate(getDate(2099, 12, 12));
//        liveQuestionnaireResultRequest.setQuestionnaireId("fs9skpv22f");
            liveQuestionnaireResultResponse = new LiveQuestionnaireServiceImpl().getQuestionnaireResultInfo(
                    liveQuestionnaireResultRequest);
            Assert.assertNotNull(liveQuestionnaireResultResponse);
            if (liveQuestionnaireResultResponse != null) {
                //to do something ......
                log.debug("测试查询频道问卷结果成功{}", JSON.toJSONString(liveQuestionnaireResultResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Testing Instructions

  1. If the request is correct, return a LiveQuestionnaireResultResponse object, based on which the B-side processes business logic.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields: [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
startDate false Date Start time, format: yyyy-MM-dd e.g., 2018-12-10
endDate false Date End time, format: yyyy-MM-dd e.g., 2018-12-10
questionnaireId false String Questionnaire ID. When submitted together with startDate/endDate, startDate/endDate become invalid, and questionnaireId takes priority as the query condition
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the POLYV official website: Official website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the POLYV official website: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

The return object is List<LiveQuestionnaireResultResponse>. The specific element content of LiveQuestionnaireResultResponse is as follows:

Parameter Name Type Description
questionnaireId String Questionnaire ID
customQuestionnaireId String User-defined questionnaire ID
questionnaireTitle String Questionnaire title
lastModified Date Last modification time of the questionnaire
endTime Date Last modification time of the questionnaire
questionStats Array Answer statistics for each question in the questionnaire [See QuestionStats Parameter Description for details]
users Array User information of respondents who submitted answers on the viewer side [See Users Parameter Description for details]
QuestionStats Parameter Description
Parameter Name Type Description
total Integer Number of respondents who answered the question
questions Array Answer statistics for individual questions under the survey [See QuestionStat Parameter Description for details]
Users Parameter Description
Parameter Type Description
viewerId String User ID of the respondent
nickname String Nickname of the respondent
submitTime Date Time of questionnaire submission
totalScore String Total score of the respondent
answers Array User's answers for each question [See Answers Parameter Description]
param4 String Custom parameter passed during external authorization or direct (standalone) authorization, returned synchronously
param5 String Custom parameter passed during external authorization or direct (standalone) authorization, returned synchronously
QuestionStat Parameter Description
Parameter Name Type Description
questionId String Question ID
questionName String Question Name
score Integer Question Score
totalScore Integer Total Score of the Question
correctCount Integer Number of Correct Answers
a Integer Number of Respondents Choosing Option a
b Integer Number of Respondents Choosing Option b
c Integer Number of Respondents Choosing Option c
d Integer Number of Respondents Choosing Option d
e Integer Number of Respondents Choosing Option e
f Integer Number of Respondents Choosing Option f
g Integer Number of Respondents Choosing Option g
h Integer Number of Respondents Choosing Option h
i Integer Number of Respondents Choosing Option i
j Integer Number of Respondents Choosing Option j
Answers Parameter Description
Parameter Type Description
questionId String Question ID
questionName String Question name
answer String Submitted answer to the question
score Integer User's score for the question
type String Type of question
R: Single choice
C: Multiple choice
Q: Open-ended question






4. Paginated Query of Survey Results

Description

分页查询直播问卷的答题结果及统计
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/questionnaire/list-answer-records

Call Constraints

  1. The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testGetQuestionnaireResultPageInfo() throws Exception, NoSuchAlgorithmException {
        LiveQuestionnaireResultPageRequest liveQuestionnaireResultPageRequest =
                new LiveQuestionnaireResultPageRequest();
        LiveQuestionnaireResultPageResponse liveQuestionnaireResultPageResponse = null;
        try {
            String channelId = super.createChannel();
            liveQuestionnaireResultPageRequest.setChannelId(channelId)
                    .setStartDate(getDate(2020, 10, 01))
                    .setEndDate(getDate(2099, 12, 12))
                    .setPageSize(20)
                    .setCurrentPage(1);
            liveQuestionnaireResultPageResponse = new LiveQuestionnaireServiceImpl().getQuestionnaireResultPageInfo(
                    liveQuestionnaireResultPageRequest);
            Assert.assertNotNull(liveQuestionnaireResultPageRequest);
            if (liveQuestionnaireResultPageResponse != null) {
                //to do something ......
                log.debug("测试分页查询频道问卷结果成功{}", JSON.toJSONString(liveQuestionnaireResultPageResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Testing Description

  1. If the request is correct, a LiveQuestionnaireResultPageResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
startDate false Date Start time, format: yyyy-MM-dd e.g., 2018-12-10
endDate false Date End time, format: yyyy-MM-dd e.g., 2018-12-10
currentPage false Integer Page number, default is 1 [Corresponds to the page field in the API documentation]
pageSize false Integer Number of data items displayed per page, default is 20 items per page
appId false String POLYV user APP_ID, required when making multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account calls). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET, required when making multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account calls). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

Parameter Name Type Description
contents Array List of channel questionnaire information and statistical results See LiveQuestionnaireResultResponse parameter description
pageSize Integer Number of data items displayed per page, default is 20 items per page
currentPage Integer Current page [Corresponds to the pageNumber field in the API documentation]
totalItems Integer Total number of records
totalPage Integer Total number of pages [Corresponds to the totalPages field in the API documentation]
LiveQuestionnaireResultResponse Parameter Description
Parameter Name Type Description
questionnaireId String Questionnaire ID
customQuestionnaireId String User-defined questionnaire ID
questionnaireTitle String Questionnaire title
lastModified Date Last modification time of the questionnaire
endTime Date Last modification time of the questionnaire
questionStats Array Answer statistics for each question in the questionnaire [See QuestionStats parameter description]
users Array User information of those who submitted answers on the viewer side [See Users parameter description]
QuestionStats Parameter Description
Parameter Name Type Description
total Integer Number of respondents who answered the question
questions Array Answer statistics for a single question under the survey [See QuestionStat Parameter Description for details]
Users Parameter Description
Parameter Type Description
viewerId String User ID of the survey submitter
nickname String Nickname of the survey submitter
submitTime Date Time of survey submission
totalScore String Total score of the survey submitter
answers Array User's answers for each question [See Answers Parameter Description]
param4 String Custom parameter passed during external authorization or direct (standalone) authorization, returned synchronously
param5 String Custom parameter passed during external authorization or direct (standalone) authorization, returned synchronously
QuestionStat parameter description
Parameter Name Type Description
questionId String Question ID
questionName String Question Name
score Integer Question Score
totalScore Integer Total Score of the Question
correctCount Integer Number of Correct Answers
a Integer Number of Respondents Choosing Option a
b Integer Number of Respondents Choosing Option b
c Integer Number of Respondents Choosing Option c
d Integer Number of Respondents Choosing Option d
e Integer Number of Respondents Choosing Option e
f Integer Number of Respondents Choosing Option f
g Integer Number of Respondents Choosing Option g
h Integer Number of Respondents Choosing Option h
i Integer Number of Respondents Choosing Option i
j Integer Number of Respondents Choosing Option j
Answers Parameter Description
Parameter Name Type Description
questionId String Question ID
questionName String Question Name
answer String Submitted answer for the question
score Integer User's score for the question
type String Type of question
R: Single choice
C: Multiple choice
Q: Essay question






5. Set Channel Survey Information

Description

接口用于编辑或添加问卷信息,为全量增加或修改
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/questionnaire/add-edit-questionnaire

Call Constraints

  1. The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testSetQuestionnaireDetailInfo() throws Exception, NoSuchAlgorithmException {
        LiveQuestionnaireDetailSetRequest liveQuestionnaireDetailSetRequest = new LiveQuestionnaireDetailSetRequest();
        LiveQuestionnaireDetailSetResponse liveQuestionnaireDetailSetResponse = null;
        try {
            String channelId = super.createChannel();
            //封装问卷请求对象
            liveQuestionnaireDetailSetRequest.setChannelId(channelId)
                    .setCustomQuestionnaireId(LiveSignUtil.generateUUID())
//                .setQuestionnaireId("fs9skpv22f")
                    .setQuestionnaireTitle("测试试卷,爱好问卷调查");
            //封装问卷题目
            LiveQuestionnaireDetailSetRequest.QuestionDetail questionDetail =
                    new LiveQuestionnaireDetailSetRequest.QuestionDetail();
            questionDetail.setQuestionId(LiveSignUtil.generateUUID())
                    .setName("您的兴趣爱好?")
                    .setAnswer("A")
                    .setScoreEnabled(LiveConstant.Flag.YES.getFlag())
                    .setRequired(LiveConstant.Flag.YES.getFlag())
                    .setOptions(Arrays.asList(new String[]{"篮球", "足球", "排球", "跑步", "羽毛球"}))
                    .setScore(20)
                    .setType(LiveConstant.QuestionType.CHECK.getType());
            LiveQuestionnaireDetailSetRequest.QuestionDetail questionDetail1 =
                    new LiveQuestionnaireDetailSetRequest.QuestionDetail();
            questionDetail1.setQuestionId(LiveSignUtil.generateUUID())
                    .setName("您的性别")
                    .setScoreEnabled(LiveConstant.Flag.NO.getFlag())
                    .setRequired(LiveConstant.Flag.YES.getFlag())
                    .setOptions(Arrays.asList(new String[]{"M", "W"}))
                    .setType(LiveConstant.QuestionType.RADIO.getType());
            LiveQuestionnaireDetailSetRequest.QuestionDetail questionDetail2 =
                    new LiveQuestionnaireDetailSetRequest.QuestionDetail();
            questionDetail2.setQuestionId(LiveSignUtil.generateUUID())
                    .setName("您的职务?")
                    .setScoreEnabled(LiveConstant.Flag.NO.getFlag())
                    .setRequired(LiveConstant.Flag.YES.getFlag())
                    .setType(LiveConstant.QuestionType.QUESTION.getType());
            //将问卷题目和问卷关联
            liveQuestionnaireDetailSetRequest.setQuestions(Arrays.asList(
                    new LiveQuestionnaireDetailSetRequest.QuestionDetail[]{questionDetail, questionDetail1,
                            questionDetail2}));
            //发送请求
            liveQuestionnaireDetailSetResponse = new LiveQuestionnaireServiceImpl().setQuestionnaireDetailInfo(
                    liveQuestionnaireDetailSetRequest);
            //判断结果
            Assert.assertNotNull(liveQuestionnaireDetailSetResponse);
            if (liveQuestionnaireDetailSetResponse != null) {
                //to do something ......
                log.debug("测试添加频道问卷成功{}", JSON.toJSONString(liveQuestionnaireDetailSetResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Testing Instructions

  1. If the request is correct, return a LiveQuestionnaireDetailSetResponse object, based on which the B-side processes business logic.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
questionnaireId false String Questionnaire ID. For a new questionnaire, this field is null; for modifying a questionnaire, this field is the questionnaire ID.
customQuestionnaireId false String Custom questionnaire ID defined by the client, used to associate with the primary key ID of their own system.
questionnaireTitle true String Questionnaire title
questions true Array List of individual question details in the questionnaire [see QuestionDetail parameter description]
appId false String POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings).
appSecret false String POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings).
QuestionDetail Parameter Description
Parameter Required Type Description
questionId false String Question ID, null when adding, must be passed when modifying the questionnaire
score false Integer Question score, used for automated scoring
name true String Question description
type true String Question type: R for single choice, C for multiple choice, Q for Q&A
scoreEnabled false String Whether the question requires scoring: Y for yes, N for no, defaults to N
answer false String Answer for choice questions, only required for choice questions that need scoring. Fill in the corresponding option sequence, e.g., A or AB
required false String Whether the question is mandatory: Y for yes, N for no, defaults to N
options false Array List of option data for single-choice or multiple-choice questions. Array indices 0-9 correspond to answers A-J

Return Object Description

Parameter Name Type Description
questionnaireId String Questionnaire ID
questionIds Array Array of question IDs under the same questionnaire
questionnaireTitle String Questionnaire title






6. Manually End a Survey

Description

结束问卷,当前频道没有问卷发布返回true
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/questionnaire/end

Call Constraints

  1. The API call is subject to rate limits. Click here for details. For common call exceptions, click here for details.

Unit Testing

    @Test
    public void testUpdatePlayDomain() throws IOException, NoSuchAlgorithmException {
        LiveQuestionnaireEndRequest liveQuestionnaireEndRequest = new LiveQuestionnaireEndRequest();
        Boolean liveQuestionnaireEndResponse = null;
        try {
            liveQuestionnaireEndRequest.setChannelIds(createChannel());
            liveQuestionnaireEndResponse = new LiveQuestionnaireServiceImpl().questionnaireStop(
                    liveQuestionnaireEndRequest);
            Assert.assertTrue(liveQuestionnaireEndResponse);
            if (liveQuestionnaireEndResponse) {
                log.debug("测试手动结束问卷成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Name Required Type Description
channelIds true String Channel IDs, multiple channels separated by commas, e.g., 100000,100001
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the Polyv official website. Path: Official website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the Polyv official website. Path: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

true: Manual end of questionnaire successful, false: Manual end of questionnaire failed

联系客服,在线咨询