categoryService
Updated: 2025-06-24 15:26:26
1. Create Video Category
Description
通过分类名称与上级分类目录id新建视频分类
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/addCata
Call Constraints
- API calls are rate-limited. Click for details. For common call exceptions, click here.
Unit Test
@Test
public void testCreateCategory() throws IOException, NoSuchAlgorithmException {
VodCreateCategoryRequest vodCreateCategoryRequest = new VodCreateCategoryRequest();
VodCreateCategoryResponse vodCreateCategoryResponse = null;
try {
vodCreateCategoryRequest.setCategoryName("Junit测试")
.setParentId("1");
vodCreateCategoryResponse = new VodCategoryServiceImpl().createCategory(vodCreateCategoryRequest);
Assert.assertNotNull(vodCreateCategoryResponse);
if (vodCreateCategoryResponse != null) {
log.debug("测试新建视频分类成功,{}", vodCreateCategoryResponse);
}
} 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
- On a successful request, a
VodCreateCategoryResponse object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed fields: [pic cannot be empty / msg cannot be empty]].
- If the server encounters an exception, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request, request ID: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
Response Object Description
2. Query Video Category
Description
通过分类id查询分类下的树结构信息,含父子节点信息
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/cataJson
Call Constraints
- API calls are rate-limited. Click for details. For common call exceptions, click here.
Unit Test
@Test
public void testGetCategory() throws IOException, NoSuchAlgorithmException {
VodGetCategoryRequest vodGetCategoryRequest = new VodGetCategoryRequest();
List<VodGetCategoryResponse> vodGetCategoryResponseList = null;
try {
vodGetCategoryRequest.setCategoryId("1");
vodGetCategoryResponseList = new VodCategoryServiceImpl().getCategory(vodGetCategoryRequest);
Assert.assertNotNull(vodGetCategoryResponseList);
if (vodGetCategoryResponseList != null) {
log.debug("测试查询视频分类成功,{}", JSON.toJSONString(vodGetCategoryResponseList));
}
} 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
- On a successful request, a
VodGetCategoryResponse object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed fields: [pic cannot be empty / msg cannot be empty]].
- If the server encounters an exception, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request, request ID: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
Response Object Description
The response is a List<VodGetCategoryResponse>. The specific elements of VodGetCategoryResponse are as follows:
3. Query Category Used Space
Description
通过分类id查询分类目录的使用空间
接口地址(仅做说明使用):https://api.polyv.net/v2/cata/size
Call Constraints
- API calls are rate-limited. Click for details. For common call exceptions, click here.
Unit Test
@Test
public void testGetCategorySize() throws IOException, NoSuchAlgorithmException {
VodGetCategorySizeRequest vodGetCategorySizeRequest = new VodGetCategorySizeRequest();
Long vodGetCategorySizeResponse = null;
try {
vodGetCategorySizeRequest.setCategoryId("1602671097888");
vodGetCategorySizeResponse = new VodCategoryServiceImpl().getCategorySize(vodGetCategorySizeRequest);
Assert.assertNotNull(vodGetCategorySizeResponse);
if (vodGetCategorySizeResponse != null) {
log.debug("测试通过分类ID查询目录使用空间成功");
}
} 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
- On a successful request, a
Long object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed fields: [pic cannot be empty / msg cannot be empty]].
- If the server encounters an exception, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request, request ID: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
Response Object Description
The size of videos under the category, in bytes.
4. Modify Category Name
Description
通过分类id修改分类名称
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/updateCata
Call Constraints
- API calls are rate-limited. Click for details. For common call exceptions, click here.
Unit Test
@Test
public void testUpdateCategoryName() throws IOException, NoSuchAlgorithmException {
VodUpdateCategoryNameRequest vodUpdateCategoryNameRequest = new VodUpdateCategoryNameRequest();
Boolean vodUpdateCategoryNameResponse = null;
try {
vodUpdateCategoryNameRequest.setCategoryId("1615536384688")
.setCategoryName("Junit测试(勿删)_3");
vodUpdateCategoryNameResponse = new VodCategoryServiceImpl().updateCategoryName(
vodUpdateCategoryNameRequest);
Assert.assertTrue(vodUpdateCategoryNameResponse);
if (vodUpdateCategoryNameResponse) {
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
- On a successful request, a
Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed fields: [pic cannot be empty / msg cannot be empty]].
- If the server encounters an exception, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request, request ID: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
Response Object Description
true indicates modification success, false indicates modification failure.
5. Modify Category Properties
Description
通过分类id修改分类属性
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/updateCataProfile
Call Constraints
- API calls are rate-limited. Click for details. For common call exceptions, click here.
Unit Test
@Test
public void testUpdateCategoryProfile() throws IOException, NoSuchAlgorithmException {
VodUpdateCategoryProfileRequest vodUpdateCategoryProfileRequest = new VodUpdateCategoryProfileRequest();
Boolean vodUpdateCategoryProfileResponse = null;
try {
vodUpdateCategoryProfileRequest.setCategoryId("1615536384688")
.setIsSettings("Y")
.setKeepSource(0)
.setEncrypt(0)
.setHlsLevel("open")
.setIsEdu(0)
.setEncodeAAC(0);
vodUpdateCategoryProfileResponse = new VodCategoryServiceImpl().updateCategoryProfile(
vodUpdateCategoryProfileRequest);
Assert.assertTrue(vodUpdateCategoryProfileResponse);
if (vodUpdateCategoryProfileResponse) {
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
- On a successful request, a
Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed fields: [pic cannot be empty / msg cannot be empty]].
- If the server encounters an exception, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request, request ID: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
Response Object Description
true indicates modification success, false indicates modification failure.
6. Move Video Category
Description
通过分类id移动视频分类
接口地址(仅做说明使用):https://api.polyv.net/v2/cata/%s/change
Call Constraints
- API calls are rate-limited. Click for details. For common call exceptions, click here.
Unit Test
@Test
public void testMoveCategory() throws IOException, NoSuchAlgorithmException {
VodMoveCategoryRequest vodMoveCategoryRequest = new VodMoveCategoryRequest();
Boolean vodMoveCategoryResponse = null;
try {
vodMoveCategoryRequest.setCategoryId("1615536384688")
.setDestCategoryId("1");
vodMoveCategoryResponse = new VodCategoryServiceImpl().moveCategory(vodMoveCategoryRequest);
Assert.assertTrue(vodMoveCategoryResponse);
if (vodMoveCategoryResponse) {
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
- On a successful request, a
Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed fields: [pic cannot be empty / msg cannot be empty]].
- If the server encounters an exception, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request, request ID: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
Response Object Description
true indicates modification success, false indicates modification failure.
7. Delete Category
Description
通过分类id删除分类
接口地址(仅做说明使用):https://api.polyv.net/v2/video/%s/deleteCata
Call Constraints
- API calls are rate-limited. Click for details. For common call exceptions, click here.
Unit Test
@Test
public void testDeleteCategory() throws IOException, NoSuchAlgorithmException {
VodDeleteCategoryRequest vodDeleteCategoryRequest = new VodDeleteCategoryRequest();
Boolean vodDeleteCategoryResponse = null;
try {
//准备测试数据
String categoryID = super.createCategoryOther();
vodDeleteCategoryRequest.setCategoryId(categoryID);
vodDeleteCategoryResponse = new VodCategoryServiceImpl().deleteCategory(vodDeleteCategoryRequest);
Assert.assertTrue(vodDeleteCategoryResponse);
if (vodDeleteCategoryResponse) {
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
- On a successful request, a
Boolean object is returned. The B-end processes business logic based on this object.
- If request parameter validation fails, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed fields: [pic cannot be empty / msg cannot be empty]].
- If the server encounters an exception, a
PloyvSdkException is thrown. The error message can be obtained via PloyvSdkException.getMessage(), e.g., [Error returned from Polyv request, request ID: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
Response Object Description
true indicates deletion success, false indicates deletion failure.