All Products
Search
Document Center

Media asset category

Last Updated: Jul 11, 2019

Initialize a client

Initialize a client before using the SDK. For more information, see initVodClient.

Create a category

#include <stdio.h>
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/*Method for creating a category*/
VodApiResponse addCategory(VodCredential authInfo) {
    string apiName = "AddCategory";
    map<string, string> args;
    // Sets the parent category ID. If you do not set this parameter, a level-1 category is generated. The root node category ID is -1.
    args["ParentId"] = "-1";
    // Sets the category name, which consists of up to 64 UTF-8 encoded bytes.
    args["CateName"] = "CateName";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = addCategory(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

For more information about the request and response parameters, see AddCategory.

Modify a category

#include <stdio.h>
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/*Method for modifying a category*/
VodApiResponse updateCategory(VodCredential authInfo) {
    string apiName = "UpdateCategory";
    map<string, string> args;
    args["CateId"] = "<CateId>";
    // Sets the category name, which consists of up to 64 UTF-8 encoded bytes.
    args["CateName"] = "CateName";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = updateCategory(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

For more information about the request and response parameters, see UpdateCategory.

Delete a category

#include <stdio.h>
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/*Method for deleting a category*/
VodApiResponse deleteCategory(VodCredential authInfo) {
    string apiName = "DeleteCategory";
    map<string, string> args;
    args["CateId"] = "<CateId>";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = deleteCategory(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

For more information about the request and response parameters, see DeleteCategory.

Query a category and its subcategories

#include <stdio.h>
#include <string>
#include <map>
#include "vod_sdk/openApiUtil.h"

/*Method for querying a category and its subcategories*/
VodApiResponse getCategories(VodCredential authInfo) {
    string apiName = "GetCategories";
    map<string, string> args;
    args["CateId"] = "<CateId>";
    args["PageNo"] = "1";
    args["PageSize"] = "10";
    return getAcsResponse(authInfo, apiName, args);
}

// Call example
void main() {
    VodCredential authInfo = initVodClient("<Your AccessKey ID>", "<Your AccessKey Secret>");
    VodApiResponse response = getCategories(authInfo);
    printf("httpCode: %d, result: %s\n", response.httpCode, response.result.c_str());
}

For more information about the request and response parameters, see GetCategories.