webInteract
1. Setting Up Prop Rewards
Description
设置道具打赏
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/donate/update-good
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 testUpdateChannelGood() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelGoodRequest liveUpdateChannelGoodRequest = new LiveUpdateChannelGoodRequest();
Boolean liveUpdateChannelGoodResponse;
try {
List<LiveUpdateChannelGoodRequest.ChannelGood> channelGoods =
new ArrayList<LiveUpdateChannelGoodRequest.ChannelGood>();
LiveUpdateChannelGoodRequest.ChannelGood channelGood = new LiveUpdateChannelGoodRequest.ChannelGood();
channelGood.setGoodName("佛跳墙")
.setGoodImg("//livestatic.videocc.net/uploaded/images/webapp/channel/donate/07-diamond.png")
.setGoodPrice(9999.99)
.setGoodEnabled("Y");
channelGoods.add(channelGood);
liveUpdateChannelGoodRequest.setChannelId(createChannel()).setEnabled("Y").setGoods(channelGoods);
liveUpdateChannelGoodResponse = new LiveWebInteractServiceImpl().updateChannelGood(
liveUpdateChannelGoodRequest);
Assert.assertNotNull(liveUpdateChannelGoodResponse);
if (liveUpdateChannelGoodResponse) {
//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 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 | false | String | Channel ID; if not provided, it is a global setting |
| enabled | false | String | Request body parameter; prop reward toggle. If not provided, defaults to enabled. Values: Y/N, where Y means enabled |
| goods | true | Array | Prop reward; the number of prop objects must be greater than 0 and less than 10. For details, see ChannelGood Parameter Description |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings) |
ChannelGood Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| goodName | true | String | Item name, cannot exceed 5 characters |
| goodImg | true | String | Item image, cannot exceed 120 characters (obtain the image URL via the image upload interface, or use default URLs; flowers: 01-flower.png; coffee: 02-coffee.png; like: 03-good.png; applause: 04-applaud.png; 666: 05-666.png; little star: 06-star.png; diamond: 07-diamond.png; sports car: 08-car.png; rocket: 09-rocket.png; the common prefix is: //livestatic.videocc.net/uploaded/images/webapp/channel/donate/) |
| goodPrice | true | Double | Item tip price |
| goodEnabled | true | String | Item toggle, value is Y/N, Y means enabled |
Return Object Description
true indicates success, false indicates failure
2. Setting Cash Tips
Description
用于设置频道或者全局现金打赏
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/donate/update-cash
Call Constraints
The API call is subject to rate limits. For details, see here. For common call exceptions, see here.
Include the channel number to set cash tips for a specific channel; omit the channel number to default to global cash tip settings.
Unit Test
@Test
public void testUpdateChannelCash() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelCashRequest liveUpdateChannelCashRequest = new LiveUpdateChannelCashRequest();
Boolean liveUpdateChannelCashResponse;
try {
Double[] floats = {0.88d, 6.66d, 8.88d, 18.11d, 66.60d, 88.89d};
List<Double> cashes = Arrays.asList(floats);
liveUpdateChannelCashRequest.setChannelId(createChannel())
.setCashes(cashes)
.setCashMin(0.02d)
.setEnabled("Y");
liveUpdateChannelCashResponse = new LiveWebInteractServiceImpl().updateChannelCash(
liveUpdateChannelCashRequest);
Assert.assertNotNull(liveUpdateChannelCashResponse);
if (liveUpdateChannelCashResponse) {
//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 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 | false | String | Channel ID; if not provided, it is a global setting |
| cashes | true | Array | Request body parameter, an array of cash tip amounts; the array length must be 6 |
| cashMin | true | Double | Request body parameter, minimum custom cash tip amount |
| enabled | false | String | Request body parameter, cash tip toggle; if not provided, it defaults to enabled. Values: Y/N, where Y means enabled |
| 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 success, false indicates failure.
3. Query Tip Settings
Description
查询打赏设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/donate/get
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 testGetChannelDonate() throws Exception, NoSuchAlgorithmException {
LiveChannelDonateRequest liveChannelDonateRequest = new LiveChannelDonateRequest();
LiveChannelDonateResponse liveChannelDonateResponse;
try {
liveChannelDonateRequest.setChannelId(createChannel());
liveChannelDonateResponse = new LiveWebInteractServiceImpl().getChannelDonate(liveChannelDonateRequest);
Assert.assertNotNull(liveChannelDonateResponse);
if (liveChannelDonateResponse != null) {
//to do something ......
log.debug("测试查询打赏设置成功,{}", JSON.toJSONString(liveChannelDonateResponse));
}
} 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, return a
LiveChannelDonateResponseobject, based on which the B-side processes the business logic.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 | false | String | Channel ID. If not provided, the global settings will be retrieved. |
| 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: 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: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| globalSettingEnabled | String | Whether to apply global settings. This value is null when retrieving global settings. |
| donateCashEnabled | String | Cash donation toggle |
| donateGoodEnabled | String | Item donation toggle |
| donateTips | String | Donation prompt |
| cashes | Array | Request body parameter, array of cash donation amounts. The array length must be 6. |
| cashMin | Double | Request body parameter, custom minimum amount for cash donation |
| goods | Array | Item donation [See ChannelGood Parameter Description] |
ChannelGood Parameter Description
| Parameter | Type | Description |
|---|---|---|
| goodName | String | Item name, cannot exceed 5 characters |
| goodImg | String | Item image, cannot exceed 120 characters (obtain the image URL via the image upload interface, or use default URLs; flowers: 01-flower.png; coffee: 02-coffee.png; like: 03-good.png; applause: 04-applaud.png; 666: 05-666.png; little star: 06-star.png; diamond: 07-diamond.png; sports car: 08-car.png; rocket: 09-rocket.png; the prefix is uniformly: //livestatic.videocc.net/uploaded/images/webapp/channel/donate/) |
| goodPrice | Double | Item tip price |
| goodEnabled | String | Item toggle, value is Y/N, Y means enabled |
4. Set Channel WeChat Sharing Information
Description
用于修改频道的微信分享相关设置
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/weixin-share/update
Call Constraints
Unit Testing
@Test
public void testUpdateChannelWxShare() throws Exception, NoSuchAlgorithmException {
LiveUpdateChannelWxShareRequest liveUpdateChannelWxShareRequest = new LiveUpdateChannelWxShareRequest();
Boolean liveUpdateChannelWxShareResponse;
try {
liveUpdateChannelWxShareRequest.setChannelId(createChannel())
.setWxShareTitle("Mysql 知识精讲")
.setWxShareDesc("带你走进Mysql的奇妙世界");
liveUpdateChannelWxShareResponse = new LiveWebInteractServiceImpl().updateChannelWxShare(
liveUpdateChannelWxShareRequest);
Assert.assertTrue(liveUpdateChannelWxShareResponse);
if (liveUpdateChannelWxShareResponse) {
//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 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, 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 |
| wxShareTitle | false | String | WeChat share title (within 30 characters) [Corresponds to the weixinShareTitle field in the API documentation] |
| wxShareDesc | false | String | WeChat share description (within 120 characters) [Corresponds to the weixinShareDesc field in the API documentation] |
| 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 success, false indicates failure
5. Query Channel WeChat Sharing Information
Description
获取频道的微信分享设置信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/weixin-share/get
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 testGetChannelWxShare() throws Exception, NoSuchAlgorithmException {
LiveGetChannelWxShareRequest liveGetChannelWxShareRequest = new LiveGetChannelWxShareRequest();
LiveGetChannelWxShareResponse liveGetChannelWxShareResponse;
try {
liveGetChannelWxShareRequest.setChannelId(createChannel());
liveGetChannelWxShareResponse = new LiveWebInteractServiceImpl().getChannelWxShare(
liveGetChannelWxShareRequest);
Assert.assertNotNull(liveGetChannelWxShareResponse);
if (liveGetChannelWxShareResponse != null) {
//to do something ......
log.debug("测试查询频道微信分享信息成功,{}", JSON.toJSONString(liveGetChannelWxShareResponse));
}
} 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, return a
LiveGetChannelWxShareResponseobject, and the B-side processes the 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 |
| 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 |
|---|---|---|
| channelId | String | Channel ID |
| channelName | String | Channel name |
| coverImg | String | WeChat share icon, i.e., the channel's live stream icon |
| wxShareTitle | String | Title for WeChat sharing [corresponds to the weixinShareTitle field in the API documentation] |
| wxShareDesc | String | Description for WeChat sharing [corresponds to the weixinShareDesc field in the API documentation] |
6. Query Channel Tip Settings
Description
查询频道打赏设置,包括现金打赏、礼物打赏,礼物打赏又分为现金支付和积分支付
接口地址(仅做说明使用):https://api.polyv.net/live/v4/user/donate/get
Call Constraints
Unit Testing
@Test
public void testGetChannelDonateV2() throws IOException, NoSuchAlgorithmException {
LiveGetChannelDonateRequest liveGetChannelDonateRequest = new LiveGetChannelDonateRequest();
LiveGetChannelDonateResponse liveGetChannelDonateResponse;
try {
String channelId = super.createChannel();
liveGetChannelDonateRequest.setChannelId(channelId);
liveGetChannelDonateResponse = new LiveWebInteractServiceImpl().getChannelDonateV2(
liveGetChannelDonateRequest);
Assert.assertNotNull(liveGetChannelDonateResponse);
if (liveGetChannelDonateResponse != null) {
//to do something ......
log.debug("测试查询频道打赏设置成功{}", JSON.toJSONString(liveGetChannelDonateResponse));
}
} 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, return a
LiveGetChannelDonateResponseobject, based on which the B-side processes business logic.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 |
| 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 |
|---|---|---|
| donateCashEnabled | String | Cash red envelope tipping toggle, Y: enabled, N: disabled |
| cashDonate | ChannelCashDonate | Cash red envelope [see ChannelCashDonate parameter description] |
| donateGiftEnabled | String | Gift tipping toggle, Y: enabled, N: disabled |
| giftDonate | Array | Gift tipping (cash payment or points payment) [see ChannelGiftDonate parameter description] |
ChannelCashDonate Parameter Description
| Parameter | Type | Description |
|---|---|---|
| cashes | Array | Fixed tip amounts, array length between 1-6, minimum value 0.01, maximum value 9999.99 [Corresponds to the cashs field in the API documentation] |
| cashMin | Float | Custom tip amount - minimum amount, minimum value 0.01, maximum value 9999.99 |
ChannelGiftDonate Parameter Description
| Parameter | Type | Description |
|---|---|---|
| payWay | String | Payment method, CASH: cash payment, POINT: points payment |
| cashUnit | String | Cash unit |
| pointUnit | String | Points unit |
| cashPays | Array | Cash payment list [See ChannelGift Parameter Description for details] |
| pointPays | Array | Points payment list [See ChannelGift Parameter Description for details] |
ChannelGift Parameter Description
| Parameter | Type | Description |
|---|---|---|
| name | String | Gift name |
| img | String | Gift image URL |
| price | Float | Gift price |
| enabled | String | Switch, Y: Enabled, N: Disabled |
ChannelGift Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| name | String | Gift name |
| img | String | Gift image URL |
| price | Float | Gift price |
| enabled | String | Switch, Y: Enabled, N: Disabled |
7. Modify Channel Gift Reward Settings
Description
修改频道礼物打赏设置,礼物打赏又分为现金支付和积分支付
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/donate/gift/update
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 testUpdateChannelDonateV2() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelDonateRequest liveUpdateChannelDonateRequest = new LiveUpdateChannelDonateRequest();
Boolean liveUpdateChannelDonateResponse;
try {
LiveUpdateChannelDonateRequest.ChannelGiftDonate giftDonate =
new LiveUpdateChannelDonateRequest.ChannelGiftDonate();
List<LiveUpdateChannelDonateRequest.ChannelGift> giftList = new ArrayList<>();
LiveUpdateChannelDonateRequest.ChannelGift gift1 = new LiveUpdateChannelDonateRequest.ChannelGift();
gift1.setImg("//liveimages.videocc.net/uploaded/images/2021/11/g41in083xo.png")
.setName("现金礼物1")
.setPrice(Float.valueOf("66.66"))
.setEnabled(LiveConstant.Flag.YES.getFlag());
giftList.add(gift1);
List<LiveUpdateChannelDonateRequest.ChannelGift> pointList = new ArrayList<>();
LiveUpdateChannelDonateRequest.ChannelGift gift2 = new LiveUpdateChannelDonateRequest.ChannelGift();
gift2.setImg("//s1.videocc.net/default-img/donate/666.png")
.setName("积分礼物1")
.setPrice(Float.valueOf("88.88"))
.setEnabled(LiveConstant.Flag.YES.getFlag());
pointList.add(gift2);
giftDonate.setPayWay(LiveConstant.PayWay.CASH.getValue())
.setCashPays(giftList)
.setPointPays(pointList)
.setPointUnit("polyv积分");
liveUpdateChannelDonateRequest.setGiftDonate(giftDonate);
liveUpdateChannelDonateRequest.setDonateGiftEnabled(LiveConstant.Flag.YES.getFlag());
liveUpdateChannelDonateRequest.setChannelId(super.createChannel());
liveUpdateChannelDonateResponse = new LiveWebInteractServiceImpl().updateChannelDonateV2(
liveUpdateChannelDonateRequest);
Assert.assertTrue(liveUpdateChannelDonateResponse);
if (liveUpdateChannelDonateResponse) {
//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 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 |
| donateGiftEnabled | false | String | Gift donation toggle, Y: enabled, N: disabled |
| giftDonate | false | ChannelGiftDonate | Gift donation (cash payment or points payment) See ChannelGiftDonate parameter description |
| appId | false | String | POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). 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 calls). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings) |
ChannelGiftDonate Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| payWay | false | String | Payment method, CASH: Cash payment, POINT: Points payment |
| cashUnit | false | String | Cash unit |
| pointUnit | false | String | Points unit |
| cashPays | false | Array | Cash payment list [See ChannelGift Parameter Description] |
| pointPays | false | Array | Points payment list [See ChannelGift Parameter Description] |
ChannelGift Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | false | String | Gift name |
| img | false | String | Gift image URL |
| price | false | Float | Gift price |
| enabled | false | String | Switch, Y: enabled, N: disabled |
ChannelGift Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| name | false | String | Gift name |
| img | false | String | Gift image URL |
| price | false | Float | Gift price |
| enabled | false | String | Switch, Y: enabled, N: disabled |
Return Object Description
Modify Channel Gift Reward Settings Return Entity
8. Query Channel Card Push
Description
查询频道卡片推送,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/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 testGetChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveGetChannelCardPushRequest liveGetChannelCardPushRequest = new LiveGetChannelCardPushRequest();
List<LiveGetChannelCardPushResponse> liveGetChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveGetChannelCardPushRequest.setChannelId(channelId);
liveGetChannelCardPushResponse = new LiveWebInteractServiceImpl().getChannelCardPush(
liveGetChannelCardPushRequest);
Assert.assertNotNull(liveGetChannelCardPushResponse);
if (liveGetChannelCardPushResponse != null) {
//to do something ......
log.debug("测试查询频道卡片推送成功{}", JSON.toJSONString(liveGetChannelCardPushResponse));
}
} 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
LiveGetChannelCardPushResponseobject 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 Name | 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
The return object is List<LiveGetChannelCardPushResponse>. The specific elements of LiveGetChannelCardPushResponse are as follows:
| Parameter Name | Type | Description |
|---|---|---|
| id | Long | Card push primary key ID |
| channelId | String | Channel ID |
| title | String | Card title, up to 16 characters |
| imageType | String | Card style type, giftbox: gift claiming style, redpack: red envelope style |
| duration | Integer | Card countdown duration, values: 0,5,10,20,30, unit: seconds, 0 means no countdown display |
| link | String | Card redirect link address, includes http://等协议头 |
| pushEndTime | Date | Push end time |
| createdTime | Date | Creation time |
| lastModified | Date | Last modified time |
| pushStatus | String | Push status: Y. Pushing, N. Not pushed, L. Last pushed |
| pushTime | Date | Push time |
| enterEnabled | String | Card entry: Y. Enabled, N. Disabled |
| showCondition | String | Display method: PUSH. Display immediately after push, WATCH. Display after watching |
| conditionValue | Integer | Watch duration |
| conditionUnit | String | Watch duration unit: SECONDS. Seconds, MINUTES. Minutes |
| countdownMsg | String | Countdown message, effective when showCondition is WATCH, up to 8 characters |
9. Create Channel Card Push
Description
创建频道卡片推送,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/create
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 testCreateChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveCreateChannelCardPushRequest liveCreateChannelCardPushRequest = new LiveCreateChannelCardPushRequest();
LiveCreateChannelCardPushResponse liveCreateChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveCreateChannelCardPushRequest.setChannelId(channelId)
.setTitle("测试SDK卡片推送")
.setLink("http://polyv.net")
.setImageType(LiveConstant.ImageType.GIFT_BOX.getValue())
.setDuration(LiveConstant.CardPushDuration.DURATION_TEN.getValue())
.setShowCondition(LiveConstant.ShowCondition.WATCH.getValue())
.setConditionValue(10)
.setConditionUnit(LiveConstant.ConditionUnit.SECONDS.getValue())
.setCountdownMsg("倒计时")
.setEnterEnabled(LiveConstant.Flag.YES.getFlag());
liveCreateChannelCardPushResponse = new LiveWebInteractServiceImpl().createChannelCardPush(
liveCreateChannelCardPushRequest);
Assert.assertNotNull(liveCreateChannelCardPushResponse);
if (liveCreateChannelCardPushResponse != null) {
//to do something ......
log.debug("测试创建频道卡片推送成功{}", JSON.toJSONString(liveCreateChannelCardPushResponse));
//TODO 此处创建完成后删除了卡片推送,正式使用需删除该语句
super.deleteChannelPushCard(channelId, liveCreateChannelCardPushResponse.getId());
}
} 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, return a
LiveCreateChannelCardPushResponseobject, based on which the B-side processes business logic.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, see 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 |
| imageType | true | String | Card style type, giftbox: gift claim style, redpack: red envelope style |
| title | true | String | Card title, up to 16 characters |
| link | true | String | Card redirect link address, must include protocol header such as http: |
| duration | true | Integer | Card countdown duration, values: 0,5,10,20,30, unit: seconds, 0 means no countdown display |
| showCondition | true | String | Display method, PUSH: pop up immediately after push, WATCH: pop up after watching |
| conditionValue | false | Integer | Watch duration for pop-up after watching, effective when showCondition is WATCH |
| conditionUnit | false | String | Unit of watch duration for pop-up after watching, SECONDS.seconds, MINUTES.minutes, effective and required when showCondition is WATCH |
| countdownMsg | false | String | Countdown text, effective when showCondition is WATCH, up to 8 characters |
| enterEnabled | true | String | Card entry switch, 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 (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) |
Return Object Description
| Parameter Name | Type | Description |
|---|---|---|
| id | Long | Card push primary key ID |
| channelId | String | Channel ID |
| title | String | Card title, up to 16 characters |
| imageType | String | Card style type, giftbox: gift claiming style, redpack: red envelope style |
| duration | Integer | Card countdown duration, values: 0,5,10,20,30, unit: seconds, 0 means no countdown display |
| link | String | Card redirect link address, includes protocol header like http: |
| pushEndTime | Date | Push end time |
| createdTime | Date | Creation time |
| lastModified | Date | Last modified time |
| pushStatus | String | Push status: Y. Pushing, N. Not pushed, L. Last push |
| pushTime | Date | Push time |
| enterEnabled | String | Card entry: Y. Enabled, N. Disabled |
| showCondition | String | Display method: PUSH. Pop up immediately after push, WATCH. Pop up after watching |
| conditionValue | Integer | Watch duration |
| conditionUnit | String | Watch duration unit: SECONDS. Seconds, MINUTES. Minutes |
| countdownMsg | String | Countdown message, effective when showCondition is WATCH, up to 8 characters |
10. Modify Channel Card Push
Description
修改频道卡片推送,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/update
Call Constraints
- The API call is subject to rate limits. For details, see [/live/java/limit.md]. For common call exceptions, see [/live/java/exceptionDoc].
Unit Testing
@Test
public void testUpdateChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelCardPushRequest liveUpdateChannelCardPushRequest = new LiveUpdateChannelCardPushRequest();
Boolean liveUpdateChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveUpdateChannelCardPushRequest.setChannelId(channelId)
.setCardPushId(super.getChannelCardPushId(channelId))
.setTitle("测试SDK修改卡片推送")
.setLink("https://polyv.net");
liveUpdateChannelCardPushResponse = new LiveWebInteractServiceImpl().updateChannelCardPush(
liveUpdateChannelCardPushRequest);
Assert.assertTrue(liveUpdateChannelCardPushResponse);
if (liveUpdateChannelCardPushResponse) {
//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, see 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 |
| cardPushId | true | Long | Card push primary key ID |
| imageType | false | String | Card style type, giftbox: gift claiming style, redpack: red envelope style |
| title | false | String | Card title, up to 16 characters |
| link | false | String | Card redirect link address, must include protocol header such as http: |
| duration | false | Integer | Card countdown duration, values: 0, 5, 10, 20, 30, unit: seconds, 0 means no countdown display |
| showCondition | false | String | Display method, PUSH: display immediately after push, WATCH: display after watching |
| conditionValue | false | Integer | Watch duration for display after watching, effective when showCondition is WATCH |
| conditionUnit | false | String | Unit of watch duration for display after watching, SECONDS: seconds, MINUTES: minutes, effective and required when showCondition is WATCH |
| countdownMsg | false | String | Countdown message, effective when showCondition is WATCH, up to 8 characters |
| enterEnabled | false | String | Card entry switch, 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
Modify the channel card push return entity
11. Delete Card Push
Description
删除卡片推送,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/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 testDeleteChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveDeleteChannelCardPushRequest liveDeleteChannelCardPushRequest = new LiveDeleteChannelCardPushRequest();
Boolean liveDeleteChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveDeleteChannelCardPushRequest.setChannelId(channelId)
.setCardPushId(super.getChannelCardPushId(channelId));
liveDeleteChannelCardPushResponse = new LiveWebInteractServiceImpl().deleteChannelCardPush(
liveDeleteChannelCardPushRequest);
Assert.assertTrue(liveDeleteChannelCardPushResponse);
if (liveDeleteChannelCardPushResponse) {
//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 |
| cardPushId | true | Long | Card push primary key 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 calls). Obtain it by registering on the Polyv official website: 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 calls). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
Delete card push return entity
12. Push Channel Card
Description
推送频道卡片,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/push
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 testPushChannelCardPush() throws IOException, NoSuchAlgorithmException {
LivePushChannelCardPushRequest livePushChannelCardPushRequest = new LivePushChannelCardPushRequest();
Boolean livePushChannelCardPushResponse;
try {
String channelId = super.createChannel();
Long cardPushId = super.getChannelCardPushId(channelId);
livePushChannelCardPushRequest.setChannelId(channelId).setCardPushId(cardPushId);
livePushChannelCardPushResponse = new LiveWebInteractServiceImpl().pushChannelCardPush(
livePushChannelCardPushRequest);
Assert.assertTrue(livePushChannelCardPushResponse);
if (livePushChannelCardPushResponse) {
//to do something ......
log.debug("测试推送频道卡片成功");
//TODO 此处创建完成后删除了卡片推送,正式使用需删除该语句
super.deleteChannelPushCard(channelId, cardPushId);
}
} 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. 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, see 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 |
| cardPushId | true | Long | Card push primary key 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: 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: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
Push channel card returns entity
13. Cancel Push Card
Description
取消推送卡片,对应新版后台的 营销-卡片
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/card-push/cancel-push
Call Constraints
- The API call is subject to rate limits. For details, see here. For common call exceptions, see here.
Unit Testing
@Test
public void testCancelPushChannelCardPush() throws IOException, NoSuchAlgorithmException {
LiveCancelPushChannelCardPushRequest liveCancelPushChannelCardPushRequest =
new LiveCancelPushChannelCardPushRequest();
Boolean liveCancelPushChannelCardPushResponse;
try {
String channelId = super.createChannel();
liveCancelPushChannelCardPushRequest.setChannelId(channelId)
.setCardPushId(super.getChannelPushingCardId(channelId));
liveCancelPushChannelCardPushResponse = new LiveWebInteractServiceImpl().cancelPushChannelCardPush(
liveCancelPushChannelCardPushRequest);
Assert.assertTrue(liveCancelPushChannelCardPushResponse);
if (liveCancelPushChannelCardPushResponse) {
//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, 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 |
| cardPushId | true | Long | Card push primary key 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 calls). Obtain it by registering on the POLYV official website: 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 calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
Cancel push card to return entity
14. Query Channel WeChat Sharing Information
Description
查询频道微信分享信息
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/share/get
Call Constraints
Unit Testing
@Test
public void testGetChannelShare() throws IOException, NoSuchAlgorithmException {
LiveGetChannelShareRequest liveGetChannelShareRequest = new LiveGetChannelShareRequest();
LiveGetChannelShareResponse liveGetChannelShareResponse;
try {
String channelId = super.createChannel();
liveGetChannelShareRequest.setChannelId(channelId);
liveGetChannelShareResponse = new LiveWebInteractServiceImpl().getChannelShare(liveGetChannelShareRequest);
Assert.assertNotNull(liveGetChannelShareResponse);
if (liveGetChannelShareResponse != null) {
//to do something ......
log.debug("测试查询频道微信分享信息成功{}", JSON.toJSONString(liveGetChannelShareResponse));
}
} 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
LiveGetChannelShareResponseobject 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 Name | 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() has been 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() has been 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 |
|---|---|---|
| shareBtnEnable | String | Whether to enable sharing, Y: enabled, N: disabled |
| titleType | String | Title type: follow live stream title, custom |
| weixinShareTitle | String | Share title, max length 50, effective when title type is custom |
| weixinShareDesc | String | Share description, max length 120, effective when title type is custom |
| weixinShareCustomUrl | String | WeChat custom share URL, max length 512 |
| webShareCustomUrl | String | Web viewing custom share URL, max length 512 |
15. Modify Channel WeChat Sharing Information
Description
修改频道微信分享信息,对应新版后台的 营销-分享设置
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/share/update
Call Constraints
Unit Testing
@Test
public void testUpdateChannelShare() throws IOException, NoSuchAlgorithmException {
LiveUpdateChannelShareRequest liveUpdateChannelShareRequest = new LiveUpdateChannelShareRequest();
Boolean liveUpdateChannelShareResponse;
try {
String channelId = super.createChannel();
liveUpdateChannelShareRequest.setChannelId(channelId)
.setShareBtnEnable(LiveConstant.Flag.YES.getFlag())
.setTitleType(LiveConstant.TitleType.FOLLOW.getValue());
liveUpdateChannelShareResponse = new LiveWebInteractServiceImpl().updateChannelShare(
liveUpdateChannelShareRequest);
Assert.assertTrue(liveUpdateChannelShareResponse);
if (liveUpdateChannelShareResponse) {
//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, see 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 |
| shareBtnEnable | true | String | Whether to enable sharing: Y for enabled, N for disabled |
| titleType | true | String | Title type: follow for live stream title, custom for custom title |
| weixinShareTitle | false | String | Share title, maximum length 50. Required when titleType is custom |
| weixinShareDesc | false | String | Share description, maximum length 120. Required when titleType is custom |
| weixinShareCustomUrl | false | String | WeChat custom share URL, maximum length 512. The link must include a protocol, e.g., https://,链接需要进行encode |
| webShareCustomUrl | false | String | Web viewing custom share URL, maximum length 512. The link must include a protocol, e.g., https://,链接需要进行encode |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtainable 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). Obtainable by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings) |
Return Object Description
Modify the channel WeChat sharing information return entity
