This documentation primarily describes the API call methods on the Tencent Cloud AI Digital Human aPaaS platform, including permissions, common parameters, and signature requirements.
API Invocation Environment
Official Environment: https://gw-sg.tvs.qq.com
Official Environment: wss://gw-sg.tvs.qq.com
Permission Application and Activation
2.1. Obtaining Necessary API Parameters
To call the interactive digital human aPass API, you must carry the appkey, accesstoken, and virtualmankey corresponding to the digital human project. The specific acquisition method can be found in the following interface of the configuration platform:
The log-in address for the following interface is https://xiaowei.cloud.tencent.com/ivh#/application
. Please log in using your Tencent Cloud account and create a project. Follow the instructions in the screenshot to obtain the appkey, accesstoken, and virtualmankey.
Requesting Common Parameters and Signature Methods
3.1. Common Parameters
When calling any API on aPaaS, you need to include the following common parameters in the URL as QueryString:
|
appkey | string | Yes | Use the appkey obtained from "2.1. Obtaining Necessary API Parameters". |
timestamp | string | Yes | Request timestamp in seconds. The timestamp cannot differ from the current time by more than five minutes, otherwise, authentication will fail. |
signature | string | Yes | Request signature (see section 3.2 for signature calculation) |
3.2. Signature Method
Request Parameter Signature Steps are as follows:
1. The signature rules are as follows. This is an example for reference only.
appkey = e38267c0e86411ebb02aed82acb0ed99
accesstoken = f68f2d10ae9e4604b76fb05cf46bccec
domain name routing = https://gw.tvs.qq.com/v2/ivh/sessionmanager/sessionmanagerservice/createsession
2. Sort all parameters except signature in lexicographical order as the plaintext for generating the signature. Currently, the HTTPS API only has two parameters: appkey and timestamp. Therefore, the sorted and concatenated string example is:
appkey=e38267c0e86411ebb02aed82acb0ed99×tamp=1646636485
Notes:
The url for the API of create long connection channel will have three parameters: appkey, requestid, and timestamp. Note that all of them need to be concatenated. Concatenation example: appkey=xxx&requestid=xxxx×tamp=xxxxx
3. Encrypt the plaintext for generating the signature using accesstoken with HmacSha256, and then perform base64 encoding.
hashBytes = HmacSha256("appkey=e38267c0e86411ebb02aed82acb0ed99×tamp=1646636485","f68f2d10ae9e4604b76fb05cf46bccec")
signature = Base64Encode(hashBytes)
4. Get the signature value:
BfWuaC9kmaicCggXc693uK+sZQ8qe88O4HVQNTdwZuo=
5. Perform urlencode on the signature value (must perform URL encoding, otherwise intermittent authentication failure will occur), and then concatenate to get the final request URL as follows:
https://gw.tvs.qq.com/v2/ivh/sessionmanager/sessionmanagerservice/createsession?appkey=e38267c0e86411ebb02aed82acb0ed99×tamp=1646636485&signature=BfWuaC9kmaicCggXc693uK%2BsZQ8qe88O4HVQNTdwZuo%3D
IV. Request and Response Structure
Request Body Structure
The request body is divided into two parameters: Header and Payload. There is no need to transmit parameters in the Header, and the business parameters for each API are transmitted in the Payload.
Notes:
Header and Payload must be included in the request body. They are essential.
{
"Header": {
},
"Payload": {
}
}
Response Body Structure
The response body is divided into two parameters: Header and Payload. The Header contains the result code, message, and the unique request ID. The specific response parameters of the API will be placed in the Payload.
{
"Header": {
"Code": 0,
"Message": "",
"RequestID": "", // generated and returned by the cloud
},
"Payload": {}
}