Polyv Help Center

Help Center

Add or Modify Channel Questionnaire

Updated: 2026-06-18 10:39:08

Legacy API endpoint Add or Modify Channel Questionnaire (Legacy)

API Description

1、创建问卷
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议

API URL

http://api.polyv.net/live/v4/channel/questionnaire/save

Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See 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 stored or used directly on the client side. All API calls must be relayed through your own server to the POLYV server. See Signature Generation Rules
channelId true Integer Channel ID

Request Body Parameter Description

Parameter Required Type Description
questionnaireTitle true String Questionnaire title
questions true Array Question array See questions field description
customQuestionnaireId false String Custom questionnaire ID
autoPublishTime false String Scheduled auto-publish time (format: "yyyy-MM-dd HH:mm"; must be at least 1 minute later than current time; required when autoEndTime is provided)
autoEndTime false String Scheduled auto-end time (format: "yyyy-MM-dd HH:mm"; must be later than autoPublishTime; required when autoPublishTime is provided)
privacyEnabled false String Privacy agreement toggle
privacyContent false String Privacy agreement content
userTags false Array Audience business tag matching conditions for targeted questionnaire display (only for external authorized viewers). When provided, the questionnaire will only be shown to external authorized viewers carrying any matching tag; if not provided or empty, the original questionnaire display logic applies. Maximum 10 tags.

questions Field Description

Parameter Required Type Description
name true String Question text
type true String Question type
R: Single choice
C: Multiple choice
Q: Q&A
J: True/False
X: Star rating
scoreEnabled false String Whether scoring is required
Y: Yes
N: No
score false String Score value
Required when scoreEnabled is Y
answer false String Answer, only for scored multiple-choice questions. Fill in the corresponding option index, e.g., A or AB
required false String Whether the question is mandatory
Y: Mandatory
N: Optional
options false String[] Required for single-choice and multiple-choice questions. Option array indices 0-9 correspond to answers A-J

Example

https://api.polyv.net/live/v4/channel/questionnaire/save?appId=frlr1zazn3&sign=439CDA1327558DFCF947F305D03AFA92&timestamp=1621843779393&channelId=20250609

Request Body Parameters

{
    "desc": "问卷简介",
    "questionnaireTitle": "自动发布",
    "questions": [
        {
            "desc": "123",
            "name": "123",
            "type": "R",
            "answer": "",
            "required": "Y",
            "scoreEnabled": "N",
            "score": 0,
            "scoreExt": null,
            "option1": "123",
            "option2": "123",
            "optionList": [
                {
                    "id": "A",
                    "name": "123"
                },
                {
                    "id": "B",
                    "name": "123"
                }
            ]
        }
    ],
    "privacyEnabled": "Y",
    "privacyContent": "<p>123</p>",
    "userTags": ["vip", "registered"],
    "autoEndTime": 1749638700000,
    "autoPublishTime": 1749463440000
}

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure See Global Error Description
status String Response status text
message String Response description. When code is 400 or 500, provides additional error details
data Object On success, returns basic questionnaire information See data field description

data Field Description

Parameter Type Description
questionnaireId String Questionnaire ID
questionIds String[] Question ID array
channelId Integer Channel ID
questionnaireTitle String Questionnaire title

Java Request Example

For quick integration, download the relevant dependency source code. Click here to download source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.

It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pooling.

private static final Logger log = LoggerFactory.getLogger(LiveInteractionTest.class);

/**
 * 设修改频道问卷
 * @throws IOException
 */
@Test
public void testAddEditQuestionnaire() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId=super.appId;
    String appSecret=super.appSecret;
    String userId = super.userId;
    String timestamp=String.valueOf(System.currentTimeMillis());
    //业务参数
    String temp = "https://api.polyv.net/live/v4/channel/questionnaire/save";

    //http 调用逻辑
    Map<String,String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp",timestamp);

    String body = "{"desc":"问卷简介","questionnaireTitle":"自动发布","questions":[{"desc":"123","name":"123","type":"R","answer":"","required":"Y","scoreEnabled":"N","score":0,"scoreExt":null,"option1":"123","option2":"123","optionList":[{"id":"A","name":"123"},{"id":"B","name":"123"}]}],"privacyEnabled":"Y","privacyContent":"<p>123</p>","userTags":["vip","registered"],"autoEndTime":1749638700000,"autoPublishTime":1749463440000}";
    requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
    String url = HttpUtil.appendUrl(temp,requestMap);
    String response = HttpUtil.postJsonBody(url, body, null);
    log.info("测试批量创建问卷接口返回值:{}",response);
    //do somethings
}

Response Example

For global error descriptions, see Global Error Description

Success Example

{
  "code": 200,
  "status": "success",
  "requestId": "ed721ebb-9add-4469-ad0f-e46db8aac206",
  "data": null,
  "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询