All Products
Search
Document Center

Initialization

Last Updated: Jul 11, 2019

Prerequisites

Initialization

The regionId parameter specifies the region of ApsaraVideo for VOD. Set this parameter to cn-shanghai for a region in China.

#include "vod_sdk/openApiUtil.h"

VodCredential initVodClient(std::string accessKeyId, std::string accessKeySecret) {
    VodCredential authInfo;
    authInfo.accessKeyId = accessKeyId;
    authInfo.accessKeySecret = accessKeySecret;
    authInfo.regionId = "cn-shanghai";
    return authInfo;
}
#include "vod_sdk/openApiUtil.h"

VodCredential initVodClient(std::string accessKeyId, std::string accessKeySecret, std::String securityToken) {
    VodCredential authInfo;
    authInfo.accessKeyId = accessKeyId;
    authInfo.accessKeySecret = accessKeySecret;
    authInfo.securityToken = securityToken;
    authInfo.regionId = "cn-shanghai";
    return authInfo;
}

FAQs

  • To link the SDK to a dynamic library, you need to ensure that the library installation directory is in the same directory as the compilation and running directories. If the directories are not in the same directory, follow these steps:
Add the library installation directory to the /etc/ld.so.conf file.
Run the ldconfig command.
  • Generally, you can link the SDK to the following libraries:
-lcurl -ljsoncpp -lvod_sdk -loss_c_sdk -lapr-1 -laprutil-1 -lmxml
  • getAcsResponse

    The getAcsResponse method is a basic method for requests. You can set the following parameters:

    • vodCredential (For more information, see initVodClient.)
    • apiName: the operation to be called.
    • args: the list of parameters. The parameter list is of the std::map type in the key-value format.
  • VodApiResponse

VodApiResponse is a type of response to the getAcsResponse method.
    If a request succeeds, the value of the httpCode element is an HTTP status code. By default, the value of the result element is a response in JSON format. You can set common request parameters, such as the response format parameter, in the args parameter.
    If a request fails, the value of the httpCode element is -1 and the value of the result element is an error message.
  • For more information, see server SDK examples.