2017-12-15 9 views
0

JS SDKを使用してAPIコールをテストするには、以下の関数を使用しています。私がコンソールログに戻ってくるのは以下の通りです。私のコードをチェックして、問題点を教えてください。JS-SDKを使用したRingCentralコールログAPIの呼び出し

このAPIによって返された応答は次のとおりです。[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 

    }); 

答えて

0

私はあなたがここに達成したいのか分かりません。 rcsdk.platformからauthDataを取得した後、setData()を使用してauthDataを戻すのはなぜですか?

どこでSDKをインスタンス化しますか?

+0

こんにちはパコ、これは私が実際に求めていたものではありません。私は主に、API呼び出しからapiResponse.json()を印刷することに関心を持っていました。しかし、私は解決策を得ました。それは私が必要としていた文字列変換でした。しかし、応答していただきありがとうございます。 get/setデータを無視する。 –

関連する問題