修改分類設定
更新時間:2024-12-31 18:37:43
介面描述
1、通过分类id修改视频分类属性设置
2、接口支持https协议
介面URL
http://api.polyv.net/v3/category/update-profile
請求方式
POST
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS確保介面安全,介面呼叫有頻率限制,詳細請查看
請求參數描述
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| userid | true | String | 保利威點播帳戶id,可參考【取得金鑰】取得,取得路徑:官網->登入->點播(API介面) |
| appId | true | String | 帳號appId【詳見取得金鑰】 |
| timestamp | true | Long | 目前時間的毫秒級時間戳,3分鐘內有效 |
| sign | true | String | 簽名,32位元大寫MD5值【詳見MD5簽名產生規則】 |
| cateId | true | Long | 分類id【可透過查詢分類列表取得】 |
| enabled | false | String | 是否啟用分類設定,預設為N:關閉 關閉時,該分類的屬性設定預設跟隨帳號影片屬性設定。啟用後,可對該分類的屬性做單獨的設定 Y:啟用 N:關閉 |
| keepSource | false | String | 原始檔案播放設定開關(僅對新上傳影片有效),預設值為0:非原始檔案播放 如果為原始檔案播放,encrypt、encryptLevel、isEdu、encodeAAC參數不生效 1:開啟 0:關閉 |
| encrypt | false | String | 影片加密設定開關(僅對新上傳影片有效),預設值為0:關閉 1:開啟 0:關閉 |
| encryptLevel | false | String | 加密等級(僅對新上傳影片有效),預設值為open:非加密授權 open:非加密授權 web:WEB授權 app:APP授權 wxa_app:小程式授權 |
| isEdu | false | String | 影片最佳化(僅對新上傳影片有效),預設值為0:關閉 1:開啟 0:關閉 |
| encodeAAC | false | String | 產生音訊檔案(僅對新上傳影片有效),預設為0:關閉 該功能只對部分有權限用戶開放 1:開啟 0:關閉 |
範例
http://api.polyv.net/v3/category/update-profile
表單參數:
isEdu=1&encode_aac=1&cateId=1617877139774&encrypt=1&appId=a0Wmol5EwX&keepSource=0&sign=05AF8FB0336F152D9140DB92A94B80F1&encryptLevel=web&userid=1b448be323&enabled=Y×tamp=1617933240089
響應參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| requestId | String | 每次請求的業務流水號,必須唯一,便於客戶端/伺服器端排查問題 |
| code | Integer | 響應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明】 |
| status | String | 響應狀態文字資訊 |
| error | Object | 錯誤資訊【詳見error欄位說明】 |
| data | Boolean | 響應成功時返回true,響應失敗返回null |
error欄位說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 錯誤碼 |
| desc | String | 錯誤描述 |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼, 點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試用例中的HttpUtil.java 和 VodSignUtil.java 都包含在下載檔案中。
強烈建議您使用點播Java SDK完成API的功能對接,點播Java SDK 對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
private static final Logger log = LoggerFactory.getLogger(VodSubAccountTest.class);
/**
* 修改分类设置
*/
@Test
public void testSubModifyCategorySetting() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.appSecret;//使用子账号的secretKey
String userid = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/v3/category/update-profile";
String appId = super.appId;
String cateId = "1617877139774";
String enabled = "Y";
String keepSource = "0";
String encrypt = "1";
String encryptLevel = "web";
String isEdu = "1";
String encode_aac = "1";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userid);
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("cateId", cateId);
requestMap.put("enabled", enabled);
requestMap.put("keepSource", keepSource);
requestMap.put("encrypt", encrypt);
requestMap.put("encryptLevel", encryptLevel);
requestMap.put("isEdu", isEdu);
requestMap.put("encode_aac", encode_aac);
//用md5进行签名
requestMap.put("sign", VodSignUtil.getSignMd5(requestMap, secretKey));
String response = HttpUtil.postFormBody(url, requestMap);
log.debug("测试修改分类设置,{}", response);
//do somethings
}
響應範例
系統全域錯誤說明詳見全域錯誤說明
成功範例
{
"requestId": "87bbd09d-0d31-45dc-a4b7-21068f5f5564",
"code": 200,
"status": "success",
"error": null,
"data": true
}
異常範例
時間戳錯誤
{
"requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
"code": 400,
"status": "error",
"error": {
"code": 100,
"desc": "invalid timestamp"
},
"data": null
}
appId不正確
{
"requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
"code": 400,
"status": "error",
"error": {
"code": 101,
"desc": "application not exist"
},
"data": null
}
子帳號不存在
{
"requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
"code": 400,
"status": "error",
"error": {
"code": 102,
"desc": "user children not exist"
},
"data": null
}
子帳號過期
{
"requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
"code": 403,
"status": "error",
"error": {
"code": 103,
"desc": "user children expired"
},
"data": null
}
簽名錯誤
{
"requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
"code": 403,
"status": "error",
"error": {
"code": 104,
"desc": "invalid signature"
},
"data": null
}
帳號權限不足
{
"requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
"code": 403,
"status": "error",
"error": {
"code": 105,
"desc": "permission limited"
},
"data": null
}
分類id不存在
{
"requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
"code": 400,
"status": "error",
"error": {
"code": 3001,
"desc": "category not exist"
},
"data": null
}
不允許修改此分類設定,只能修改根目錄下的一級目錄
{
"requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
"code": 400,
"status": "error",
"error": {
"code": 3005,
"desc": "category could not be modified"
},
"data": true
}
