Giter VIP home page Giter VIP logo

Comments (4)

zqfan avatar zqfan commented on August 16, 2024 1

@roura356a tencentcloud-sdk-nodejs is a SDK for Tencent Cloud API 3.0 (with endpoint *.tencentcloudapi.com), the document you referred is Tencent Cloud API 2.0 (with endpoint *.api.qcloud.com/v2/index.php). Since they are not compatible, you cannot get what you want with API 2.0 parameters while calling API 3.0 interface.

There is a tool, named API Explorer, which can be used to get familiar with API 3.0, while generating simple SDK source code, for this particular interface, please refer to: https://console.cloud.tencent.com/api/explorer?Product=monitor&Version=2018-07-24&Action=GetMonitorData&SignVersion=

here is the source code I generated with the tool, you can adjust the parameters according to you purpose:

const tencentcloud = require("../../../../tencentcloud-sdk-nodejs");


const MonitorClient = tencentcloud.monitor.v20180724.Client;
const models = tencentcloud.monitor.v20180724.Models;

const Credential = tencentcloud.common.Credential;
const ClientProfile = tencentcloud.common.ClientProfile;
const HttpProfile = tencentcloud.common.HttpProfile;

let cred = new Credential("masked-secret-id", "masked-secret-key");
let httpProfile = new HttpProfile();
httpProfile.endpoint = "monitor.tencentcloudapi.com";
let clientProfile = new ClientProfile();
clientProfile.httpProfile = httpProfile;
let client = new MonitorClient(cred, "ap-guangzhou", clientProfile);

let req = new models.GetMonitorDataRequest();

let params = '{"Namespace":"QCE/CVM","MetricName":"CPUUsage","Instances":[{"Dimensions":[{"Name":"InstanceId","Value":"ins-oxbabxrc"}]}]}'
req.from_json_string(params);


client.GetMonitorData(req, function(errMsg, response) {

    if (errMsg) {
        console.log(errMsg);
        return;
    }

    console.log(response.to_json_string());
});

The document you need to read is https://cloud.tencent.com/document/product/248/30385 , unfortunately it is Chinese simplified only.

from tencentcloud-sdk-nodejs.

rouralberto avatar rouralberto commented on August 16, 2024

Ohh got it, @zqfan! Thank you so much for the clarification. I'm still quite new with Tencent Cloud. I'll be more aware from now on about this differences 👍

from tencentcloud-sdk-nodejs.

rouralberto avatar rouralberto commented on August 16, 2024

Sadly the Api Explorer is locked to the Chinese portal and I can't access with my international login.

from tencentcloud-sdk-nodejs.

zqfan avatar zqfan commented on August 16, 2024

I thought it just doesn't support English.
International account is different, I think the support will not be soon.

from tencentcloud-sdk-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.