method not allowed

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I am getting this error of "Method Not Allowed" when trying to retrieve the call logs through PHP.

RingCentral API Error -> Method Not Allowed

Any Ideas?

$call_log_url = '/account/~/extension/~/call-log';
$ref = &$this->connection->platform;

try {
    $apiResponse = $ref->post($call_log_url);
// dd($apiResponse);
}
catch (\RingCentral\SDK\Http\ApiException $e) {
echo 'RingCentral API Error -> <b>' . $e->getMessage() . '</b>';
}
Photo of Justin Nahin

Justin Nahin

  • 114 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of AK

AK, Official Rep

  • 4,402 Points 4k badge 2x thumb
Hi Justin,

You should be using a GET request instead of a POST request in order to retrieve call logs through the API.

Please have a look at the code below :

try {
    
$apiResponse = $platform->get('/account/~/extension/~/call-log', array(
'perPage' => 10
));
print 'Retreieved Call logs' . $apiResponse->json()->uri . PHP_EOL;
} catch (\RingCentral\SDK\Http\ApiExceptionHttpException $e) {
    echo 'RingCentral API Error -> <b>' . $e->getMessage() . '</b>';
}
Photo of Justin Nahin

Justin Nahin

  • 114 Points 100 badge 2x thumb
Wow, thanks so much Anil!  Was stuck on this one for days.