Question

method not allowed

  • 7 October 2015
  • 2 replies
  • 3041 views

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 (RingCentralSDKHttpApiException $e) {
    echo 'RingCentral API Error -> <b>' . $e->getMessage() . '</b>';
}      

2 replies

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 (RingCentralSDKHttpApiExceptionHttpException $e) {
    echo 'RingCentral API Error -> <b>' . $e->getMessage() . '</b>';
}

This is a general kind of mistake every developers does now and then. It we hit an API with wrong method type eg hit GET method in API where the API expect POST and vice versa, this Method Not Allowed occurs.

Reading the full documentation is required in this case

Reply