简体   繁体   English

使用JS-SDK调用RingCentral Call-Log API

[英]Calling RingCentral Call-Log API using the JS-SDK

I am using the below function to test the API Call using the JS SDK. 我正在使用以下功能来使用JS SDK测试API调用。 What I am getting back in the console log is as below. 我在控制台日志中返回的内容如下。 Can you please check my code and let me know what is the issue here. 您能否检查我的代码,让我知道这里的问题。

The response returned by this API is: [object Object] 此API返回的响应为: [object Object]

The response JSON returned by this API is: [object Object] 此API返回的响应JSON是: [object Object]

app.get('/log', function(req, res) {

var authData = rcsdk.platform().auth().data();
rcsdk.platform().auth().setData(authData);
token_json = authData['access_token'] ? 
JSON.stringify(authData.access_token, null, ' ') : '';
response = token_json;

console.log("Before the/account/~/extension/~/presence");

rcsdk.platform().get('/account/~/extension/~/call-
log').then(function(apiResponse){
// If you want the response object
console.log("The response returned by this API is : " + 
apiResponse.response());
   // If you want the response object as JSON
console.log("The response JSON returned by this API is : " + 
apiResponse.json());
}); 

console.log("Outside the API Request");

res.render('index', {
authorize_uri: rcsdk.platform().authUrl({
 brandId: process.env.RC_APP_BRAND_ID,        // optional
  redirectUri: process.env.RC_APP_REDIRECT_URL // optional if 1 
configured
}),
redirect_uri: process.env.RC_APP_REDIRECT_URL,
token_json: token_json,
dibyendu_roy: response
});

    // Render home page with params

    });

I don't know what you want to achieve here. 我不知道您想在这里实现什么。 Why you get the authData from the rcsdk.platform then set it back with the setData() ? 为什么要从rcsdk.platform获取authData ,然后使用setData()将其重新设置?

Where do you instantiate the SDK? 您在哪里实例化SDK?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM