调用 UpdateInPageAdvertisement接口,在指定直播间中新增、更新或删除页中广告。
通过本接口的 Advertisements 参数,您可以新增、更新和删除直播间中的页中广告。
Id 的取值设置为 0,即可新增页中广告。Id 参数值并按需更新页中广告的配置信息,即可更新该页中广告。为保证广告配置信息的参数值不被清空,即便参数在该接口中为非必选,也必须传入对应的参数值。说明
为避免直播间中已有的页中广告被误删,或配置信息被清空,您必须将不需要删除和更新的页中广告 ID 及其配置信息作为请求参数传入该接口。您可调用 GetInPageAdvertisement 接口,通过返回参数 Advertisements 获取当前直播间中所有页中广告的配置信息。
下表仅列出该接口特有的请求参数和部分公共参数。更多信息详见公共参数。
| 参数 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | UpdateInPageAdvertisement | 接口名称。当前 API 的名称为 UpdateInPageAdvertisement。 |
| Version | String | 是 | 2023-08-01 | 接口版本。当前 API 的版本为 2023-08-01。 |
| 参数 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
ActivityId | Long | 是 |
| 直播间 ID。您可通过调用 ListActivityAPI 接口获取 ID。 说明 使用子账号调用接口时,确保该直播间对子账号可见。有关如何配置子账号的可见范围,详见子账号管理。 |
IsEnable | Integer | 是 |
| 是否开启页中广告。开启后,观看页展示页中广告。取值如下:
|
EnableFloating | Boolean | 是 |
| 是否开启浮层展示。取值如下:
|
Advertisements | Array of Advertisements | 否 |
| 页中广告信息。 说明
|
| 参数 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Id | Long | 是 | 0 | 页中广告 ID,用于新增、更新或删除页中广告。详见接口行为。 |
| ImageUrl | String | 是 | https://p.example.org/example.png | 页中广告的图片地址,需包含协议头。 |
| HomeUrl | String | 否 | https://example.com | 页中广告的跳转链接,需包含协议头。 |
| 参数 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Status | Boolean | true | 是否操作成功。成功返回 true。 |
POST https://livesaas.volcengineapi.com/?Action=UpdateInPageAdvertisement&Version=2023-08-01 { "ActivityId": 177985****487296, "IsEnable": 1, "EnableFloating": false, "Advertisements": [ { "ImageUrl": "https://p.example.org/example.png", "HomeUrl": "https://example.com", "Id": 0 } ] }
{ "ResponseMetadata": { "RequestId": "20230604110420****100232280022D31", "Action": "UpdateInPageAdvertisement", "Version": "2023-08-01", "Service": "livesaas", "Region": "cn-north-1", "SystemTime": 1697446406 }, "Result": { "Status": true } }