Modify Channel Product Information
API Description
1、编辑频道商品库商品信息
2、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/product/update
<a href="/req.html?api=http://api.polyv.net/live/v3/channel/product/update"" target="_blank">Online API Call
Request Method
POST
Interface Constraints
- The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls are subject to frequency limits. For details, please refer to.
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 key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server and retrieve response data. [See Signature Generation Rules] |
| channelId | true | String | Channel ID |
Request Body Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| productId | true | Integer | Product library product ID |
| name | true | String | Product name, required, length range: 1-100 Note: The API supports up to 100 characters, but the live streaming backend settings only support up to 50 characters |
| status | true | Integer | Product listing status 1: Listed 2: Unlisted |
| linkType | true | Integer | Product link type 10: Universal link 11: Multi-platform link |
| cover | false | String | Product cover image URL, length range: 1-500 |
| yield | false | String | Financial product parameter, product yield/price, e.g., 87.99% |
| link | false | String | Universal link (linkType=10) Product link, length 1-500, required Multi-platform link (linkType=11), optional |
| pcLink | false | String | PC redirect link, length 1-500 |
| mobileLink | false | String | Mobile web link |
| wxMiniprogramLink | false | String | WeChat Mini Program link |
| wxMiniprogramOriginalId | false | String | WeChat Mini Program ID |
| wxMiniprogramAppId | false | String | WeChat Mini Program App ID |
| mobileAppLink | false | String | Mobile App link |
| productDesc | false | String | Product description |
| androidLink | false | String | Multi-platform link, mobile APP - Android native page link |
| iosLink | false | String | Multi-platform link, mobile APP - iOS native page link |
| btnShow | false | String | Button display text |
| params | false | String | Custom parameters, JSON object, e.g.: {"id":21,"color":"blue","level":1} This parameter is received as a String type and needs to be escaped in the request, see the request body parameter example below |
| tagIds | false | String | Product tag IDs, JSON object, e.g.: [1,2,3] |
| productDetail | false | String | Product details |
| ext | false | String | Extension information: JSON object string: {"coverList":["Cover image URLs, max 15"], "videoList":[{"videoSource":"Video source", "videoId":"Video ID"}]} [See details in EXT] |
| features | false | String | This parameter is received as a String type JSON object and needs to be escaped in the request, see the request body parameter example below For regular products (productType is normal): product tags, JSON array, e.g.: ["tab1", "tab2"]For financial products (productType is finance): product tags, JSON array, e.g.: ["tab1", "tab2"]For job products (productType is position): job tags, JSON array, e.g.: ["tab1", "tab2", "tab3"], use empty strings if there are fewer than three job tags |
| - | - | - | Parameters specific to regular products below (productType=normal) |
| priceType | false | String | Product actual price type, optional values: AMOUNT: Amount CUSTOM: Custom Defaults to AMOUNT if not provided |
| realPrice | false | Float | Product actual price - amount, required when priceType=AMOUNT, maximum precision of two decimal places, e.g., 12.34 |
| customPrice | false | String | Product actual price - custom, required when priceType=CUSTOM, maximum 20 characters |
| originalPriceType | false | String | Product original price (strikethrough price) type, optional values: AMOUNT: Amount CUSTOM: Custom Defaults to AMOUNT |
| price | false | Float | Product original price (strikethrough price) - amount, effective when originalPriceType=AMOUNT, maximum precision of two decimal places, e.g., 12.34 |
| customOrignalPrice | false | String | Product original price (strikethrough price) - custom, effective when originalPriceType=CUSTOM, maximum 20 characters Note: If both price and customOriginalPrice are empty, the original price (strikethrough price) is not enabled |
| - | - | - | Parameters specific to regular products above (productType=normal) |
EXT
| Parameter | Required | Type | Description |
|---|---|---|---|
| coverList | true | Array | Array of cover image URLs, up to 15 |
| videoList | false | Array | Array of videos, up to 1 See details in ChannelProductExtVideo. Requires the material library to be enabled. |
| jumpWay | false | String | Jump method for external link purchase - universal link: POP_UP - open in popup, NEW_WINDOW - open in new window, CURRENT_WINDOW - open in current window |
ChannelProductExtVideo
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| videoId | true | String | Video ID |
| videoSource | true | String | Video source: MATERIAL_LIBRARY - Material Library |
Example
http://api.polyv.net/live/v3/channel/product/update?appId=frlr1zazn3&sign=4C8FCD995644EEB248AB2CE70329F4D2&channelId=1965681×tamp=1621843510009
Request Body Parameters
{
"productId": 27538,
"name": "开心豆",
"price": 0.99,
"cover": "//liveimages.videocc.net/uploadimage/20200827/chat_img_1779741_15985125681801.jpeg?x-oss-process=image/crop,x_95,y_0,w_235,h_235",
"link": "",
"status": 1,
"realPrice": 1.99,
"yield": "87.99%",
"linkType": 11,
"pcLink": "https://www.polyv.net/",
"mobileLink": "",
"wxMiniprogramLink": "",
"wxMiniprogramOriginalId": "",
"mobileAppLink": "",
"params": "{\"color\": \"red\"}",
"productDetail" : "<p>这是商品详情!</p>"
}
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, when code is 400 or 500, provides additional error details |
| data | String | Returns SUCCESS on success, empty on failure |
Java Request Example
For quick integration of the 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. The test cases HttpUtil.java and LiveSignUtil.java are both included in the downloaded file.
It is strongly recommended that you use the Live Java SDK to complete the API functionality integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 修改商品信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testUpdateChannelProduct() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/product/update";
String channelId = "1965681";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
String body = "{\"productId\":27538,\"name\":\"开心豆\",\"price\":0.99,\"cover\":\"//liveimages.videocc.net/uploadimage/20200827/chat_img_1779741_15985125681801.jpeg?x-oss-process=image/crop,x_95,y_0,w_235,h_235\",\"link\":\"\",\"status\":1,\"realPrice\":1.99,\"linkType\":11,\"pcLink\":\"https://www.polyv.net\",\"mobileLink\":\"\",\"wxMiniprogramLink\":\"\",\"wxMiniprogramOriginalId\":\"\",\"mobileAppLink\":\"\",\"params\":\"{\\\"cc\\\": 11}\"}";
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, body, null);
log.info("测试修改商品信息:{}", response);
//do somethings
}
Response Example
For a detailed explanation of system-wide errors, please refer to the Global Error Description.
Successful Example
{
"code": 200,
"status": "success",
"message": "",
"data": "SUCCESS"
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
