Polyv Help Center

Help Center

Batch Create Channel Promotions

Updated: 2025-05-20 15:00:10

Interface Description

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

Interface URL

http://api.polyv.net/live/v4/channel/popularization/create-batch

Online API Call

Request Method

POST

Interface Constraints

  1. The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details on obtaining keys
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 saved or used directly on the client side. All APIs must be relayed through the customer's own server to call the POLYV server for response data. See signature generation rules

Request Body Parameter Description

Parameter Required Type Description
names true Array Channel promotion names (A single channel supports creating up to 500 promotions, including historical ones. Array elements are strings, each promotion name has a maximum of 20 characters)
channelId true Integer Channel ID

Example

https://api.polyv.net/live/v4/channel/popularization/create-batch?appId=frlr1zazn3&sign=439CDA1327558DFCF947F305D03AFA92&timestamp=1621843779393

Request Body Parameters

{
  "channelId": 10002,
  "names": ["渠道1", "渠道2"]
}

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 Array List of basic channel information on successful response See data field description

Data Field Description

Parameter Type Description
promoteId String Promotion ID
popularizationName String Channel promotion name

Java Request Example

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

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

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

/**
 * 批量创建渠道推广
 * @throws IOException
 */
@Test
public void testBatchCreatePopularization() 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/popularization/create-batch";

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

    String body = "{\"channelId\":10002,\"names\":[\"渠道1\",\"渠道2\"]}";
    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 system global error descriptions, see Global Error Description

Success Example

{
  "code": 200,
  "status": "success",
  "requestId": "ed721ebb-9add-4469-ad0f-e46db8aac206",
  "data": [
      {
        "promoteId": "Fq5gpU",
        "questionnaireId": "渠道1"
      },
      {
        "promoteId": "Fq5gp1",
        "popularizationName": "渠道2"
      }
  ],
  "success": true
}

Error Example

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