Polyv Help Center

Help Center

Add Information Collection

Updated: 2026-07-16 23:19:19

API Description

1、创建一个新的信息采集配置(表单),可用于报名、登记、福袋领奖等场景收集观众信息
2、字段与管理后台信息采集配置保持一致
3、请求体参数不参与签名,签名仅使用URL参数(appId、timestamp)
4、接口支持https协议

API URL

http://api.polyv.net/live/v4/user/info-collection/form/create

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
  2. Set the request header contentType: application/json

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 within 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret used to generate the signature is critical for communication data security. It must not be stored or used directly on the client. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. [See Signature Generation Rules]

Request Body Parameter Description

The request body is a JSON object with the following fields:

Parameter Required Type Description
formName true String Information collection name, max 100 characters
privacyForceCheckEnabled false String Whether to force check the privacy agreement
Y: Yes
N: No (default)
fields false Array List of collection field definitions [See fields field description]
privacyList false Array List of privacy statements, max 5 [See privacyList field description]

fields Field Description

Parameter Required Type Description
fieldType true String Field type
mobile: Phone number
name: Name
radio: Single choice
checkbox: Multiple choice
textarea: Question & answer
email: Email
text: Text box
number: Numeric text box
area: Region
upload: Image upload
tips: Tip
privacy: Privacy statement
fieldName false String Field name, max 100 characters
rank true Integer Sort order, ascending
required false String Whether required
Y: Required
N: Optional
options false String Option values, used for single/multiple choice types
placeholder false String Placeholder text, max 255 characters
smsCheckEnabled false String Whether to enable SMS verification (phone number type)
Y: Enable
N: Disable
areaCodeEnabled false String Whether to enable area code (phone number type)
Y: Enable
N: Disable
chatNicknameEnabled false String Whether to sync as chat nickname
Y: Enable
N: Disable
uploadMaxCount false Integer Maximum number of images to upload, only for upload type, values 1/2/3

fieldKey does not need to be provided when creating; it is auto-generated by the server. When editing, it must be returned as-is.

privacyList Field Description

Parameter Required Type Description
rank true Integer Sort order
title true String Title, max 200 characters
content false String Content
linkUrl false String Link URL, max 500 characters

Example

http://api.polyv.net/live/v4/user/info-collection/form/create?appId=xxx&sign=xxx&timestamp=xxx

Request body parameters:

{
    "formName": "问卷调研",
    "privacyForceCheckEnabled": "N",
    "fields": [
        {
            "fieldType": "name",
            "fieldName": "姓名",
            "rank": 1,
            "required": "Y",
            "placeholder": "请输入姓名"
        },
        {
            "fieldType": "mobile",
            "fieldName": "手机号",
            "rank": 2,
            "required": "Y",
            "smsCheckEnabled": "N",
            "areaCodeEnabled": "N"
        }
    ],
    "privacyList": []
}

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure [See Global Error Description]
status String Response status text
message String Response description, provides error details when code is 400 or 500
data Long Returns the newly created form ID on success

Java Request Example

For quick integration of basic code, download the relevant dependency source code. Click here to download the 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 testCreateInfoCollection() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId=super.appId;
    String appSecret=super.appSecret;
    String timestamp=String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/live/v4/user/info-collection/form/create";

    //签名仅使用URL参数,请求体不参与签名
    Map<String,String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp",timestamp);
    requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));

    String json = "{\"formName\":\"问卷调研\",\"privacyForceCheckEnabled\":\"N\",\"fields\":[{\"fieldType\":\"name\",\"fieldName\":\"姓名\",\"rank\":1,\"required\":\"Y\"},{\"fieldType\":\"mobile\",\"fieldName\":\"手机号\",\"rank\":2,\"required\":\"Y\"}],\"privacyList\":[]}";
    url = HttpUtil.appendUrl(url, requestMap);
    String response = HttpUtil.postJsonBody(url, json, null);

    log.info("测试新增信息采集接口返回值:{}",response);
    //do somethings
}

Response Example

For global error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": 52
}

Error Example

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