tencent cloud

CloudAPISignatureV3Param
Last updated: 2025-03-11 20:21:27
CloudAPISignatureV3Param
Last updated: 2025-03-11 20:21:27
CloudAPISignatureV3Param is the parameter object used when calling the util.cloudAPISignatureV3 method for signing.

Field

Field
Type
Description
secretID
string
Secret ID, used to identify the API caller.
secretKey
string
Secret Key, used to authenticate the API caller.
service
string
Product name.
method
string
Call method, such as "POST".
timestamp
string
Timestamp
body
string, object, or ArrayBuffer.
Request body.
query
Record<string, string>
Request parameters.
headers
Record<string, string>
Request header.

Samples

Call the util.cloudAPISignatureV3 method for signing:
import util from 'pts/util';
import http from 'pts/http';

export default function () {
const timestamp = parseInt(new Date().getTime() / 1000);
const body = {
EnvironmentId: 'wtp',
TopicName: 'access_server',
ClusterId: 'pulsar-vgb3w9ezndvx',
};
const headers = {
'Content-Type': 'application/json',
Host: 'tdmq.tencentcloudapi.com',
'X-TC-Action': 'DescribeSubscriptions',
'X-TC-Version': '2020-02-17',
'X-TC-Timestamp': timestamp.toString(),
'X-TC-Region': 'ap-guangzhou',
};
// Call util.cloudAPISignatureV3, the internal parameter is CloudAPISignatureV3Param
headers.Authorization = util.cloudAPISignatureV3({
secretID: 'xxx',
secretKey: 'xxx',
service: 'tdmq',
method: 'POST',
timestamp,
headers,
body,
});
const resp = http.post('https://tdmq.tencentcloudapi.com', body, {
headers,
});
console.log(resp.body);
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback