Submit Viewer Registration Information
Allows the integrator to submit registrations on behalf of viewers within their own page/App. Registration data enters the channel's existing registration statistics, and the review process is consistent with the Polyv backend. Use together with Query Channel Registration Viewing Configuration and Query Viewer Registration and Review Status.
API Description
1、接入方指定频道,传入观众ID与报名账号,提交保利威后台报名表单对应的信息
2、频道未开启报名时不允许提交,返回错误码1175
3、按后台表单的必填要求及格式规则校验,校验失败返回明确错误原因,不保存本次提交
4、通过本接口提交报名时,不要求也不校验保利威短信验证码,手机号真实性由接入方自行负责(保利威观看页仍按后台配置执行短信验证)
5、同一观众(观众ID)重复提交时:已审核通过的报名幂等返回成功;其余情况更新原报名记录(表单内容、报名账号跟随本次提交更新),不会重复生成报名记录
6、开启审核的频道,新报名进入待审核状态(W),由保利威后台审核;审核结果通过[查询观众报名及审核状态](__PLV_KEEP_2__)获取,提交成功不代表审核通过
7、接口产生的报名记录纳入已有的报名提交及审核结果回调【详见[报名观看回调](__PLV_KEEP_3__)】,回调中的观众ID与报名记录一致
8、接口支持https协议
API URL
http://api.polyv.net/live/v4/channel/enroll/record/save
Request Method
POST
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls are subject to rate limits. For details, please see
Please set the request header contentType:application/json. Only URL parameters (appId, timestamp, channelId, etc.) are used for signing; request body parameters do not participate in signing [see Signature Generation Rules for details]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId [see Obtain Secret Key for details] |
| 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 key information for communication data security and must never be stored on the client for direct use. All APIs must be called through the customer's own server to relay requests to the POLYV server and obtain response data [see Signature Generation Rules for details] |
Request Body Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | Integer | Channel ID |
| code | true | String | Registration account type, mobile: mobile phone, email: email |
| mobile | true | String | Registration account, mobile phone number or email address (pass email when code is email), length not exceeding 40 characters |
| viewerId | true | String | Integrator viewer ID. The same viewer's registration records are associated with this ID, length not exceeding 64 characters |
| content | true | String | Registration form content, a JSON format string: {"field id": "field value"}. The field id corresponds to fields.id returned by Query Channel Registration Viewing Configuration |
Example
http://api.polyv.net/live/v4/channel/enroll/record/save?appId=frlr1zazn3&sign=16DC042339E27BAD00452D004C1FA9CA×tamp=1731128494801
Request body JSON example
{
"channelId": 5588786,
"code": "mobile",
"mobile": "13100001111",
"viewerId": "viewer001",
"content": "{\"4085178\": \"13100001111\", \"4085180\": \"张三\"}"
}
Response Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for successful return, non-200 for failure |
| status | String | Response result, returns success on success, error on failure |
| success | Boolean | Response result, returns true on success, false on failure |
| data | Object | The API only returns the submission result, with no business data; for review status, please obtain it via Query Viewer Registration and Review Status |
| error | Object | Error information when the status code is non-200 [see Error Field Description for details] |
| requestId | String | Request ID, a unique UUID generated for each request. It can only be used for troubleshooting and debugging and should not be tied to business logic |
Error Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| code | Integer | Error code, used to determine the specific cause of the error. Common for this API: 1175: registration viewing is not enabled for the channel; 1176: required registration form fields are missing; 1038: invalid email address format |
| desc | String | Error description, corresponding to error.code |
Java Request Example
For quick integration basic code, please download the relevant dependency source code, click to download the source code, and add it to your own source project after downloading. HttpUtil.java and LiveSignUtil.java in the test cases are both included in the downloaded files.
It is strongly recommended that you use the Live Java SDK to complete API integration. The Live Java SDK uniformly encapsulates and optimizes API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(ChannelEnrollControllerTest.class);
/**
* 提交观众报名信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testSaveEnrollRecord() 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/channel/enroll/record/save";
Integer channelId = 5588786;
String viewerId = "viewer001";
String code = "mobile";
String mobile = "13100001111";
// 字段id与「查询频道报名观看配置」返回的 fields.id 对应
String content = "{\"4085178\": \"13100001111\", \"4085180\": \"张三\"}";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", String.valueOf(channelId));
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("channelId", channelId);
jsonMap.put("code", code);
jsonMap.put("mobile", mobile);
jsonMap.put("viewerId", viewerId);
jsonMap.put("content", content);
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("提交观众报名信息,返回值:{}", response);
// do somethings
}
Response Example
For system global error descriptions, see Global Error Description
Success example
{
"code": 200,
"status": "success",
"success": true,
"data": null
}
Exception example (registration not enabled for the channel)
{
"code": 400,
"status": "error",
"success": false,
"error": {
"code": 1175,
"desc": "频道未开启报名观看"
}
}
Exception example (required registration form fields missing)
{
"code": 400,
"status": "error",
"success": false,
"error": {
"code": 1176,
"desc": "报名表单必填项缺失"
}
}
