Delete Advertisement
Updated: 2025-01-14 16:12:43
API Description
1、通过广告id删除对应广告
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
API URL
http://api.polyv.net/v2/advertising/{userid}/delete
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have frequency limits. See details
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| ptime | true | Long | Current time in milliseconds, valid within 3 minutes |
| sign | true | String | Signature, a 40-character uppercase SHA1 value. The secretkey used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules |
| adid | true | String | Advertisement ID. Refer to Query Advertisement List to obtain this value. |
Example
http://api.polyv.net/v2/advertising/1b448be323/delete
Form Parameters:
adid=ccb3b2e89668407e833b&sign=BBBF7D2623B68EDE2BA941039377A2E0287CC30A&ptime=1617765315741
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure. See Global Error Description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, it provides additional error details. |
| data | Object | Returns true on success, returns empty on failure. |
Error Code List
| Error Code | message | Description |
|---|---|---|
| 400 | sign can not be empty. | Signature is empty. |
| 400 | ptime is too old. | Timestamp has expired. |
| 400 | ptime is illegal. | Timestamp format is incorrect or exceeds the current time by 3 minutes. |
| 400 | Could not find user by userid. | User ID does not exist. |
| 400 | the sign is not right. | Signature is incorrect. |
| 400 | adid is empty | Advertisement ID is empty. |
| 200 | success | Submission successful. |
Java Request Example
For quick integration, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own project. The test cases include HttpUtil.java and VodSignUtil.java in the downloaded file.
It is strongly recommended to use the VOD Java SDK for API integration. The VOD Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(VodVideoAdvertising.class);
/**
* 删除广告
*/
@Test
public void testDeleteAdvertising() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userid = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/advertising/%s/delete", userid);
String adid = "ccb3b2e89668407e833b";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("adid", adid);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFormBody(url, requestMap);
log.debug("测试删除广告,{}", response);
//do somethings
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "success",
"data": true
}
Error Example
{
"code": 400,
"status": "error",
"message": "ptime is too old.",
"data": ""
}
