腾讯云 API NODEJS SDK
npm install tencentcloud-sdk-nodejs-intl-enSecretID, SecretKey, and endpoint. The general format of endpoint is \*.intl.tencentcloudapi.com. For example, the endpoint of CVM is cvm.intl.tencentcloudapi.com. For more information, please see the documentation of the specified product.SecretID and SecretKey. SecretID is for identifying the API requester. SecretKey is a key used for signature string encryption and authentication by the server. Please keep your SecretKey private and do not disclose it to others.js
const tencentcloud = require("../../../../tencentcloud-sdk-nodejs-intl-en");// Import the client models of the corresponding product module.
const CvmClient = tencentcloud.cvm.v20170312.Client;
const models = tencentcloud.cvm.v20170312.Models;
const Credential = tencentcloud.common.Credential;
// Instantiate an authentication object. The Tencent Cloud account
secretId and secretKey need to be passed in as the input parameters
let cred = new Credential("secretId", "secretKey");// Instantiate the client object of the requested product (with CVM as an example)
let client = new CvmClient(cred, "ap-shanghai");
// Instantiate a request object
let req = new models.DescribeInstancesRequest();
// Call the API you want to access through the client object. You need to pass in the request object and the response callback function
client.DescribeInstances(req, function(err, response) {
// The request is returned exceptionally, and the exception information is printed
if (err)
console.log(err);
return;
}
// The request is returned normally, and the response object is printed
console.log(response.to_json_string());
});
`More examples
For more examples, please go to the
examples directory.Relevant Configuration
Proxy
If there is a proxy in your environment, you need to set the system environment variable
https_proxy`; otherwise, it may not be called normally, and a connection timeout exception will be thrown.