2017-12-15 8 views
0

아래 함수를 사용하여 JS SDK를 사용하여 API 호출을 테스트합니다. 콘솔 로그에서 내가 얻는 것은 아래와 같다. 제 코드를 확인하고 문제가 무엇인지 알려주시겠습니까? 이 API에 의해 반환JS-SDK를 사용하여 RingCentral Call-Log 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()를 사용하여 다시 설정합니까?

어디에서 SDK를 인스턴스화합니까?

+0

안녕하세요 Paco, 이것은 제가 실제로 요구했던 것이 아닙니다. API 호출에서 apiResponse.json()을 인쇄하는 데 주로 관심이있었습니다. 그러나 해결책을 얻었습니다. 필자가 필요로하는 바로 문자열 변환이었습니다. 그러나 응답 해 주셔서 감사합니다. get/set 데이터 부분을 무시하십시오. –