全部产品
云市场

媒资分类

更新时间:2018-12-28 14:17:35

初始化客户端

使用前请先初始化客户端,参考 initVodClient 接口。

创建分类

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /*创建分类函数*/
  6. VodApiResponse addCategory(VodCredential authInfo) {
  7. string apiName = "AddCategory";
  8. map<string, string> args;
  9. // 父分类ID,若不填,则默认生成一级分类,根节点分类ID为-1
  10. args["ParentId"] = "-1";
  11. // 分类名称,不能超过64个字节,UTF8编码
  12. args["CateName"] = "CateName";
  13. return getAcsResponse(authInfo, apiName, args);
  14. }
  15. // 请求示例
  16. void main() {
  17. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  18. VodApiResponse response = addCategory(authInfo);
  19. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  20. }

接口参数和返回字段请参考 AddCategory

修改分类

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /*修改分类函数*/
  6. VodApiResponse updateCategory(VodCredential authInfo) {
  7. string apiName = "UpdateCategory";
  8. map<string, string> args;
  9. args["CateId"] = "<CateId>";
  10. // 分类名称,不能超过64个字节,UTF8编码
  11. args["CateName"] = "CateName";
  12. return getAcsResponse(authInfo, apiName, args);
  13. }
  14. // 请求示例
  15. void main() {
  16. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  17. VodApiResponse response = updateCategory(authInfo);
  18. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  19. }

接口参数和返回字段请参考 UpdateCategory

删除分类

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /*删除分类函数*/
  6. VodApiResponse deleteCategory(VodCredential authInfo) {
  7. string apiName = "DeleteCategory";
  8. map<string, string> args;
  9. args["CateId"] = "<CateId>";
  10. return getAcsResponse(authInfo, apiName, args);
  11. }
  12. // 请求示例
  13. void main() {
  14. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  15. VodApiResponse response = deleteCategory(authInfo);
  16. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  17. }

接口参数和返回字段请参考 DeleteCategory

查询分类及其子分类

  1. #include <stdio.h>
  2. #include <string>
  3. #include <map>
  4. #include "vod_sdk/openApiUtil.h"
  5. /*查询分类及其子分类函数*/
  6. VodApiResponse getCategories(VodCredential authInfo) {
  7. string apiName = "GetCategories";
  8. map<string, string> args;
  9. args["CateId"] = "<CateId>";
  10. args["PageNo"] = "1";
  11. args["PageSize"] = "10";
  12. return getAcsResponse(authInfo, apiName, args);
  13. }
  14. // 请求示例
  15. void main() {
  16. VodCredential authInfo = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  17. VodApiResponse response = getCategories(authInfo);
  18. printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
  19. }

接口参数和返回字段请参考 GetCategories