channelProduct
1. Adding Channel Products
Description
添加频道商品库商品
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/add
Call Constraints
The API call has a frequency limit. See details. For common call exceptions, see details.
When the product type is a regular product, the product name, product cover link, actual product price, product listing status, and product link type are mandatory. The corresponding link must be provided based on the product link type.
When the product type is a financial product, the product name, product listing status, and product link type are mandatory. The corresponding link must be provided based on the product link type.
Unit Test
@Test
public void testAddChannelProduct() throws IOException, NoSuchAlgorithmException {
LiveAddProductRequest liveAddProductRequest = new LiveAddProductRequest();
LiveAddProductResponse liveAddProductResponse;
try {
LiveAddProductRequest.ExtObject ext = new LiveAddProductRequest.ExtObject();
ext.setCoverList(Arrays.asList("https://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"https://s1.videocc.net/live-admin-v3/assets/img/5c5f0d2242a07f21.svg"));
LiveAddProductRequest.Video video = new LiveAddProductRequest.Video();
video.setVideoId("b820ac35dc3bb6be0dcb0841fcb379db");
video.setVideoSource("MATERIAL_LIBRARY");
ext.setVideoList(Collections.singletonList(video));
ext.setJumpWay("POP_UP");
liveAddProductRequest.setChannelId(super.createChannel())
.setName("测试添加普通产品1")
.setProductType("normal")
.setStatus(1)
.setLinkType(11)
.setPcLink("http://polyv.net")
.setMobileLink("http://polyv.net")
.setMobileAppLink("http://polyv.net")
.setWxMiniProgramLink("pages/home/index.html")
.setCover("https://liveimages.videocc.net/assets/wimages/pc_images/logo.png")
.setWxMiniProgramOriginalId("xxxxxxx")
.setYield("88")
.setFeatures("[\"tab1\", \"tab2\", \"tab3\", \"tab4\"]")
.setBtnShow("立即了解")
.setProductDesc("测试描述")
.setRealPrice(100F)
.setParams("{\"code\":123,\"color\":\"red\"}")
.setProductDetail("你能够点击购买<br/>为我们购买助力<a href='https://polyv.com'></a>")
.setExtObject(ext)
.setTagIds("[100,102,103]")
.setOriginalPriceType("CUSTOM")
.setCustomOriginalPrice("199.00")
.setAppId(super.getLiveAppInfo().getAppId())
.setAppSecret(super.getLiveAppInfo().getAppSecret());
liveAddProductResponse = new LiveChannelProductServiceImpl().addChannelProduct(liveAddProductRequest);
Assert.assertNotNull(liveAddProductResponse);
if (liveAddProductResponse != null) {
log.debug("测试添加频道商品成功 {}", JSON.toJSONString(liveAddProductResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
If the request is correct, a
LiveAddProductResponseobject is returned, and the B-side processes the business logic based on this object.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields: [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| name | true | String | Product name, length range: 1-60 |
| status | true | Integer | Product listing status: 1: listed, 2: delisted |
| linkType | true | Integer | Product link type: 10: universal link, 11: multi-platform link |
| link | false | String | Product link, link address length: 1-500: Required when linkType=10, optional when linkType=11 |
| pcLink | false | String | Multi-platform link, PC-side redirect link, link address length: 1-500: Optional when linkType=10, required when linkType=11 |
| mobileLink | false | String | Multi-platform link, mobile web link |
| wxMiniProgramLink | false | String | Multi-platform link, mini-program page path and parameters (for the path attribute, the declared page path must include the .html suffix, e.g., pages/home/index.html) [Corresponds to the wxMiniprogramLink field in the API documentation] |
| wxMiniProgramOriginalId | false | String | Multi-platform link, mini-program original ID [Corresponds to the wxMiniprogramOriginalId field in the API documentation] |
| mobileAppLink | false | String | Multi-platform link, mobile app link |
| androidLink | false | String | Multi-platform link, mobile app - Android native page link |
| iosLink | false | String | Multi-platform link, mobile app - iOS native page link |
| params | false | String | Custom parameters, JSON object type, needs to be converted to string |
| productDesc | false | String | Product description |
| features | false | String | Product features, selling point tags, can be multiple, JSON field, e.g., ["tab1", "tab2"] |
| cover | false | String | General product parameter, product cover link, required when product type is general product, length range: 1-500 |
| realPrice | false | Float | General product parameter, actual product price, required when product type is general product, rounded to two decimal places, e.g., 0.01 |
| price | false | Float | General product parameter, original product price, rounded to two decimal places, e.g., 0.01 |
| btnShow | false | String | Financial product parameter, button display text |
| yield | false | String | Financial product parameter, product yield/price |
| productType | false | String | Product type, default is general product: normal: general product, finance: financial product |
| originId | false | String | Platform product ID (if present, the platform product library copies and creates a new channel product; in this case, only the status field is required for other fields) |
| strategy | false | String | Strategy for copying platform products when originId is not empty. Optional values: copy - copy, ref - reference (recommended), default is copy (referencing platform product library products: changes to product fields in the platform product library are automatically synced to the channel product library. Copying platform product library products: changes to product fields in the platform product library are not automatically synced to the channel product library) |
| productDetail | false | String | Product details, displayed for general products |
| priceType | false | String | Price type, default is AMOUNT for amount, CUSTOM for custom price |
| customPrice | false | String | Purchase price - custom, effective when priceType=CUSTOM |
| tagIds | false | String | Product tag ID list: JSON array string, format: [100,102,103] |
| originalPriceType | false | String | Original product price (strikethrough price) type, possible values: AMOUNT: amount, CUSTOM: custom |
| customOriginalPrice | false | String | Original product price (strikethrough price) - custom note: if both price and customOriginalPrice are empty, the original price (strikethrough price) is not enabled |
| extObject | false | ExtObject | Extended information object [See ExtObject Parameter Description for details] |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website, path: Official website -> Login -> Live (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website, path: Official website -> Login -> Live (Development Settings) |
ExtObject Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| coverList | false | Array | Array of cover image URLs, up to 15 |
| videoList | false | Array | Array of videos, up to 1. Requires enabling the material library. See Video parameter description |
| jumpWay | false | Array | 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) |
Video Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | false | String | Video ID |
| videoSource | false | String | Video source: MATERIAL_LIBRARY - Material Library |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| productId | Integer | Product ID |
| userId | String | POLYV user ID, consistent with the one on the Polyv official website. Retrieval path: Official website -> Login -> Live (Development Settings) |
| channelId | String | Channel ID |
| name | String | Product name, length range: 1-60 |
| price | Float | Regular product parameter, original price, with two decimal places, e.g., 0.01 |
| cover | String | Product cover image URL |
| link | String | Product link for general product type |
| status | Integer | Product listing status: 1: Listed, 2: Unlisted |
| createdTime | Date | Product creation time |
| lastModified | Date | Product update time |
| rank | Integer | Product sort order |
| realPrice | Float | Actual product price, with two decimal places, e.g., 0.01 |
| type | String | Platform identifier, default is 'live', others are invalid |
| linkType | Integer | Product link type: 10: General link, 11: Multi-platform link |
| pcLink | String | Multi-platform link, PC redirect URL |
| mobileLink | String | Multi-platform link, mobile web redirect URL |
| wxMiniProgramLink | String | Multi-platform link, WeChat Mini Program redirect URL [corresponds to the wxMiniprogramLink field in the API documentation] |
| wxMiniProgramOriginalId | String | Multi-platform link, WeChat Mini Program original ID [corresponds to the wxMiniprogramOriginalId field in the API documentation] |
| mobileAppLink | String | Multi-platform link, mobile app redirect URL |
| androidLink | String | Multi-platform link, mobile app - Android native page URL |
| iosLink | String | Multi-platform link, mobile app - iOS native page URL |
| params | String | Custom parameters, type is JSON object, needs to be converted to string |
| productType | String | Product type, normal: Regular product, finance: Financial product |
| btnShow | String | Button display text |
| features | String | Product features, selling point tags, can be multiple, JSON field, e.g., ["tab1", "tab2"] |
| productDesc | String | Product description |
| yield | String | Financial product parameter, product yield/price |
| productDetail | String | Product details, returns a content storage address, e.g., https://liveimages.videocc.net/product-info/product-detail/4d57ea01de/704007d1fdfd4cb2a5b3d3a842418831.json URL contains the product detail content |
| priceType | String | Price type, default is AMOUNT if not specified, CUSTOM for custom price |
| customPrice | String | Purchase price - custom, effective when priceType=CUSTOM |
| tagIds | String | Product tag ID list: JSON array string, format like: [100,102,103] |
| originalPriceType | String | Original price (strikethrough price) type, possible values: AMOUNT: Amount, CUSTOM: Custom |
| customOriginalPrice | String | Original price (strikethrough price) - custom note: If both price and customOriginalPrice are empty, the original price (strikethrough price) is not enabled |
| extObject | ExtObject | Extension information object [see ExtObject parameter description] |
ExtObject Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| coverList | false | Array | Array of cover image URLs, up to 15 |
| videoList | false | Array | Array of videos, up to 1. Requires enabling the media library. See Video parameter description |
| jumpWay | false | Array | Jump method for external purchase - universal link: POP_UP (open in popup), NEW_WINDOW (open in new window), CURRENT_WINDOW (open in current window) |
Video Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | false | String | Video ID |
| videoSource | false | String | Video source: MATERIAL_LIBRARY - Material Library |
2. Modify Channel Product Information
Description
修改频道商品库商品信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/update
Call Constraints
The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
When the product type is a regular product, the product name, product cover link, actual product price, product listing status, and product link type are mandatory. The corresponding link must be provided based on the product link type.
When the product type is a financial product, the product name, product listing status, and product link type are mandatory. The corresponding link must be provided based on the product link type.
Unit Test
@Test
public void testUpdateChannelProduct() throws IOException, NoSuchAlgorithmException {
LiveUpdateProductRequest liveUpdateProductRequest = new LiveUpdateProductRequest();
Boolean liveUpdateProductResponse;
try {
LiveUpdateProductRequest.ExtObject extObject = new LiveUpdateProductRequest.ExtObject()
.setCoverList(Arrays.asList("https://liveimages.videocc.net/assets/wimages/pc_images/logo.png",
"https://s1.videocc.net/live-admin-v3/assets/img/5c5f0d2242a07f21.svg"))
.setVideoList(Collections.singletonList(new LiveUpdateProductRequest.Video()
.setVideoId("b820ac35dc3bb6be0dcb0841fcb379db")
.setVideoSource("MATERIAL_LIBRARY")))
.setJumpWay("POP_UP");
String ext = JSON.toJSONString(extObject);
liveUpdateProductRequest.setChannelId(createChannel())
.setProductId(getChannelProductId(createChannel()))
.setCover("https://liveimages.videocc.net/uploadimage/20200827/chat_img_1779741_15985125681801.jpeg")
.setRealPrice(Float.MIN_VALUE)
.setName("测试修改普通产品")
.setStatus(1)
.setProductType("normal")
.setLinkType(11)
.setPcLink("http://polyv.net")
.setMobileLink("http://polyv.net")
.setMobileAppLink("http://polyv.net")
.setWxMiniProgramLink("pages/home/index.html")
.setWxMiniProgramOriginalId("xxxxxxx")
.setYield("88.88")
.setFeatures("[\"tab1\", \"tab2\", \"tab3\", \"tab4\"]")
.setBtnShow("立即了解")
.setProductDesc("测试描述")
.setParams("{\"code\":123,\"color\":\"red\"}")
.setProductDetail("你能够点击购买<br/>为我们购买助力<a href='https://polyv.com'></a>")
.setTagIds("[100,102,103]")
.setPriceType("CUSTOM")
.setCustomPrice("99.00")
.setOriginalPriceType("CUSTOM")
.setCustomOriginalPrice("199.00")
.setExtObject(extObject)
.setExt(ext)
.setExtObject(null)
.setAppId(super.getLiveAppInfo().getAppId())
.setAppSecret(super.getLiveAppInfo().getAppSecret());
liveUpdateProductResponse = new LiveChannelProductServiceImpl().updateChannelProduct(
liveUpdateProductRequest);
Assert.assertTrue(liveUpdateProductResponse);
if (liveUpdateProductResponse != null) {
log.debug("测试修改频道商品信息成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
If the request is correct, a Boolean object is returned. The B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields: [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| productId | true | Integer | Product ID in the product library |
| name | true | String | Product name, required, length range: 1-60 |
| status | true | Integer | Product listing status: 1: listed, 2: delisted |
| linkType | true | Integer | Product link type: 10: universal link, 11: multi-platform link |
| realPrice | false | Float | Regular product parameter, required when the product type is regular product. Product purchase price, with two decimal places, e.g., 0.01 |
| cover | false | String | Product cover link, required, length range: 1-500 |
| price | false | Float | Product price, with two decimal places, e.g., 0.01 |
| link | false | String | Universal link, product link, length 1-500. Required when linkType=10; invalid when linkType=11 |
| pcLink | false | String | Multi-platform link, PC-side redirect link, length 1-500. Required when linkType=11; invalid when linkType=10 |
| mobileLink | false | String | Multi-platform link, mobile web-side link |
| wxMiniProgramLink | false | String | Multi-platform link, page path and parameters within the mini program (the declared page path must have a .html suffix, e.g., pages/home/index.html) [Corresponds to the wxMiniprogramLink field in the API documentation] |
| wxMiniProgramOriginalId | false | String | Multi-platform link, original ID of the mini program [Corresponds to the wxMiniprogramOriginalId field in the API documentation] |
| mobileAppLink | false | String | Multi-platform link, mobile app-side link |
| androidLink | false | String | Multi-platform link, mobile APP - Android native page link |
| iosLink | false | String | Multi-platform link, mobile APP - iOS native page link |
| params | false | String | Custom parameters, type JSON object, needs to be converted to string |
| productDesc | false | String | Product description |
| productDetail | false | String | Product details |
| features | false | String | Product features, selling point tags, can be multiple, JSON field, e.g., ["tab1", "tab2"] |
| btnShow | false | String | Financial product parameter, button display text |
| yield | false | String | Financial product parameter, product yield/price |
| productType | false | String | Product type, defaults to regular product: normal: regular product, finance: financial product |
| tagIds | false | String | Product tag IDs, JSON object, e.g., [1,2,3] |
| priceType | false | String | Product actual price type, optional values: AMOUNT: amount, CUSTOM: custom, defaults to AMOUNT if not provided |
| 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 |
| customOriginalPrice | 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 |
| extObject | false | ExtObject | Extension information object [See ExtObject Parameter Description for details] |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings) |
ExtObject Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| coverList | false | Array | Array of cover image URLs, up to 15 |
| videoList | false | Array | Array of videos, up to 1. Requires enabling the media library. See Video parameter description |
| jumpWay | false | Array | Jump method for external purchase via universal link: POP_UP (open in popup), NEW_WINDOW (open in new window), CURRENT_WINDOW (open in current window) |
Video Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| videoId | false | String | Video ID |
| videoSource | false | String | Video source: MATERIAL_LIBRARY - Material library |
Return Object Description
null
3. Query Channel Product Library Switch Status
Description
查询频道商品库开关状态
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/get-enabled
Call Constraints
- The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testGetChannelProductEnabled() throws IOException, NoSuchAlgorithmException {
LiveGetProductEnabledRequest liveGetProductEnabledRequest = new LiveGetProductEnabledRequest();
LiveGetProductEnabledResponse liveGetProductEnabledResponse;
try {
liveGetProductEnabledRequest.setChannelId(createChannel());
liveGetProductEnabledResponse = new LiveChannelProductServiceImpl().getChannelProductEnabled(
liveGetProductEnabledRequest);
Assert.assertNotNull(liveGetProductEnabledResponse);
if (liveGetProductEnabledResponse != null) {
//to do something ......
log.debug("测试查询频道商品库开关状态成功{}", JSON.toJSONString(liveGetProductEnabledResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, a
LiveGetProductEnabledResponseobject is returned, and the B-side processes business logic based on this object.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| enabled | String | Switch status, Y: enabled, N: disabled |
4. Query Channel Product List
Description
获取频道商品库商品列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/list
Call Constraints
- The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testGetChannelProductList() throws IOException, NoSuchAlgorithmException {
LiveGetProductListRequest liveGetProductListRequest = new LiveGetProductListRequest();
LiveGetProductListResponse liveGetProductListResponse;
try {
liveGetProductListRequest.setChannelId(createChannel()).setCurrentPage(1).setPageSize(2);
liveGetProductListResponse = new LiveChannelProductServiceImpl().getChannelProductList(
liveGetProductListRequest);
Assert.assertNotNull(liveGetProductListResponse);
if (liveGetProductListResponse != null) {
//to do something ......
log.debug("测试查询频道商品列表成功{}", JSON.toJSONString(liveGetProductListResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, a
LiveGetProductListResponseobject is returned, and the B-side processes business logic based on this object.If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| currentPage | false | Integer | Page number, defaults to 1 [corresponds to the page field in the API documentation] |
| pageSize | false | Integer | Number of data items displayed per page, defaults to 20 |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| contents | Array | List of queried products [see channelProductList parameter description] |
| pageSize | Integer | Number of data items displayed per page, default is 20 items per page |
| currentPage | Integer | Current page [corresponds to the pageNumber field in the API documentation] |
| totalItems | Integer | Total number of records |
| totalPage | Integer | Total number of pages [corresponds to the totalPages field in the API documentation] |
channelProductList Parameter Description
| Parameter | Type | Description |
|---|---|---|
| productId | Integer | Product ID |
| userId | String | POLYV user ID, consistent with the official POLYV website. Retrieval path: Official website -> Login -> Live (Development Settings) |
| channelId | String | Channel ID |
| name | String | Product name |
| price | Float | Product price, with two decimal places, e.g., 0.01 |
| cover | String | Product cover image URL |
| link | String | Product link for general product types |
| status | Integer | Product listing status, 1: Listed, 2: Unlisted |
| createdTime | Date | Product creation time, format: yyyy-MM-dd HH:mm:ss |
| lastModified | Date | Product update time, format: yyyy-MM-dd HH:mm:ss |
| rank | Integer | Product sort order |
| realPrice | Float | Actual product price, with two decimal places, e.g., 0.01 |
| type | String | Platform identifier, default is live, others are invalid |
| linkType | Integer | Product link type, 10: General link, 11: Multi-platform link |
| pcLink | String | Multi-platform link, PC redirect URL |
| mobileLink | String | Multi-platform link, mobile web redirect URL |
| wxMiniProgramLink | String | Multi-platform link, WeChat Mini Program redirect URL [Corresponds to the wxMiniprogramLink field in the API documentation] |
| wxMiniProgramOriginalId | String | Multi-platform link, WeChat Mini Program original ID [Corresponds to the wxMiniprogramOriginalId field in the API documentation] |
| mobileAppLink | String | Multi-platform link, mobile app redirect URL |
| androidLink | String | Multi-platform link, mobile app - Android native page URL |
| iosLink | String | Multi-platform link, mobile app - iOS native page URL |
| params | String | Custom parameters, JSON object type, needs to be converted to string |
| productType | String | Product type, normal: General product, finance: Financial product |
| btnShow | String | Button display text |
| features | String | Product features, selling point tags, can be multiple, JSON field, e.g., ["tab1", "tab2"] |
| productDesc | String | Product description |
| yield | String | Financial product parameter, product yield/price |
| showId | Integer | Display ID |
5. Modify Channel Product Library Switch Status
Description
修改频道商品库商品列表开关状态,开启后,观看页将展示商品列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/update-enabled
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testUpdateChannelProductEnabled() throws IOException, NoSuchAlgorithmException {
LiveUpdateProductEnabledRequest liveUpdateProductEnabledRequest = new LiveUpdateProductEnabledRequest();
Boolean liveUpdateProductEnabledResponse;
try {
liveUpdateProductEnabledRequest.setChannelId(createChannel()).setEnabled("Y");
liveUpdateProductEnabledResponse = new LiveChannelProductServiceImpl().updateChannelProductEnabled(
liveUpdateProductEnabledRequest);
Assert.assertTrue(liveUpdateProductEnabledResponse);
if (liveUpdateProductEnabledResponse) {
//to do something ......
log.debug("测试修改频道商品库开关状态成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Description
If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. SeePloyvSdkException.getMessage()for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| enabled | true | String | Switch status, Y: enabled, N: disabled |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the POLYV official website, path: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the POLYV official website, path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates modification succeeded, false indicates modification failed.
6. Modify the Shelf Status of Channel Product Library
Description
修改频道商品库商品上下架状态
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/shelf
Call Constraints
- The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].
Unit Testing
@Test
public void testShelfChannelProduct() throws IOException, NoSuchAlgorithmException {
LiveShelfChannelProductRequest liveShelfChannelProductRequest = new LiveShelfChannelProductRequest();
Boolean liveShelfChannelProductResponse;
try {
liveShelfChannelProductRequest.setChannelId(createChannel())
.setProductId(super.getChannelProductId(createChannel()))
.setShelf(1);
liveShelfChannelProductResponse = new LiveChannelProductServiceImpl().shelfChannelProduct(
liveShelfChannelProductRequest);
Assert.assertTrue(liveShelfChannelProductResponse);
if (liveShelfChannelProductResponse) {
//to do something ......
log.debug("测试修改频道商品库上下架状态成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Testing Instructions
If the request is correct, a Boolean object is returned. The B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| productId | true | Integer | Product ID |
| shelf | true | Integer | Product shelf status, 1: listed, 2: delisted |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates modification succeeded, false indicates modification failed
7. Push Channel Product Library Items
Description
推送频道商品库商品
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/push-product
Call Constraints
The API call has a frequency limit. For details, see here. For common call exceptions, see here.
Only products in the "listed" status can be pushed.
Unit Test
@Test
public void testPushChannelProduct() throws IOException, NoSuchAlgorithmException {
LivePushProductRequest livePushProductRequest = new LivePushProductRequest();
Boolean livePushProductResponse;
try {
livePushProductRequest.setChannelId(createChannel())
.setProductId(super.getChannelProductId(createChannel()));
livePushProductResponse = new LiveChannelProductServiceImpl().pushChannelProduct(livePushProductRequest);
Assert.assertTrue(livePushProductResponse);
if (livePushProductResponse) {
//to do something ......
log.debug("测试推送频道商品库商品成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| productId | true | Integer | Product ID |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the POLYV official website: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtained by registering on the POLYV official website: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates the push was successful, false indicates the push failed.
8. Modify the Order of Channel Product Library List
Description
修改商品库商品列表顺序
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/sort
Call Constraints
The API call is subject to rate limits. Click here for details. For common call exceptions, click here for details.
The first item cannot be moved up, and the last item cannot be moved down.
Unit Test
@Test
public void testSortChannelProduct() throws IOException, NoSuchAlgorithmException {
LiveSortChannelProductRequest liveSortChannelProductRequest = new LiveSortChannelProductRequest();
Boolean liveSortChannelProductResponse;
try {
liveSortChannelProductRequest.setChannelId(createChannel())
.setProductId(super.getChannelProductId(createChannel()))
.setType(20);
liveSortChannelProductResponse = new LiveChannelProductServiceImpl().sortChannelProduct(
liveSortChannelProductRequest);
Assert.assertTrue(liveSortChannelProductResponse);
if (liveSortChannelProductResponse) {
//to do something ......
log.debug("测试修改频道商品库列表顺序成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
If the request is correct, a Boolean object is returned, and the B-side processes the business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| productId | true | Integer | Product ID |
| type | true | Integer | Product move operation, 10: move up, 20: move down |
| sort | false | Integer | Required when type is 50, the target position to move to (range: 1 ~ total number of products) |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website, path: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website, path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates modification succeeded, false indicates modification failed.
9. Delete Channel Product
Description
删除频道商品库商品
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/product/delete
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Testing
@Test
public void testDeleteChannelProduct() throws IOException, NoSuchAlgorithmException {
LiveDeleteChannelProductRequest liveDeleteChannelProductRequest = new LiveDeleteChannelProductRequest();
Boolean liveDeleteChannelProductResponse;
try {
//准备测试数据
Integer productId = super.getChannelProductId(createChannel());
liveDeleteChannelProductRequest.setChannelId(createChannel()).setProductId(productId);
liveDeleteChannelProductResponse = new LiveChannelProductServiceImpl().deleteChannelProduct(
liveDeleteChannelProductRequest);
Assert.assertTrue(liveDeleteChannelProductResponse);
if (liveDeleteChannelProductResponse) {
//to do something ......
log.debug("测试删除频道商品成功");
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
}
Unit Testing Instructions
If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.
If request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found viaPloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| productId | true | Integer | Product ID |
| appId | false | String | POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
| appSecret | false | String | POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
Return Object Description
true indicates successful deletion, false indicates failed deletion
