Question

404 error when using call-log API

  • 28 February 2020
  • 1 reply
  • 624 views

I'm using Node and trying to do a simple API call to the call log. My code came from the docs, but modified a bit. Login works just fine so my credentials are ok.


const fetch = require('node-fetch');

const SDK = require('@ringcentral/sdk').SDK;

RINGCENTRAL_CLIENTID = '<SECRET>';
RINGCENTRAL_CLIENTSECRET = '<SECRET>';
RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com';
RINGCENTRAL_USERNAME = '<SECRET>';
RINGCENTRAL_PASSWORD = '<SECRET>';
RINGCENTRAL_EXTENSION = '101';
var rcsdk = new SDK({
    server: RINGCENTRAL_SERVER,
    clientId: RINGCENTRAL_CLIENTID,
    clientSecret: RINGCENTRAL_CLIENTSECRET
});
const platform = rcsdk.platform();

exports.handler = async function(event, context) {

  await rcLogin();
  let callLog = await rcCallLog();
  console.log(log);

    return {
      statusCode: 200,
      body: JSON.stringify(log)
    }


}

async function rcLogin() {
  return platform.login({
    username: RINGCENTRAL_USERNAME,
    password: RINGCENTRAL_PASSWORD,
    extension: RINGCENTRAL_EXTENSION
  });
}

async function rcCallLog() {

  return platform.get('/account/~/extension/~/call-log', {
    view: 'Detailed'
  })

}


Specifically the error is: errorMessage: '404 Not Found'


1 reply

Ok, so this worked:


  return platform.get('/restapi/v1.0/account/~/extension/~/call-log',


Are the docs wrong here? https://developers.ringcentral.com/guide/voice/call-log/reading-call-log

Reply