I've been researching on how to access the logs for RingCentral for a while now and I'm having a bit of trouble. Essentially, I want to use a file on our web server to call the API and fetch all the records for every user (not just the owner account that I have the credentials set up on). Afterwards, I plan to store them in our database but I don't think I'll have issues there. From the link below, and other alternatives I've tried (Zapier), it appears that I need the username, password, and extension to get all this information collectively. Is there a way to get this information without requiring all users' passwords?
https://developers.ringcentral.com/guide/voice/call-log/reading-call-log#php
You need to login your app with an admin user and use the account call log API:
https://developers.ringcentral.com/api-reference/Call-Log/readCompanyCallLog
Thank you for reaching out!
I think that page leads me to have more questions. What is the accountid and where can I find it in the ringCentral account? What is the serverURL for the getenv variable? Also, the 27th line shows login information where the password is still required, right?
Just use the tilde sign "~" for the account id. And of course you need to have a username/password credentials to log in.
More references:
Thanks for the heads up. I'm still having a bit of trouble. I can get the authorization code now but I can't seem to get the token. Here is the code that I'm using:
curl_setopt_array($curlpost, array( CURLOPT_URL => "https://platform.devtest.ringcentral.com/restapi/oauth/token?code={$authCode}&grant_type={$grant_type}&redirect_uri={$redirect_uri}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => array( "Accept: application/json", "Content-Type: application/x-www-form-urlencoded", "Authorization: Basic " .$base64test ), ));
The grant type is set to "authorization_code", auth code is set to the authorization code provided from the initial get request, and the redirect uri is correct. base64test is clientid:clientsecret (and I'm not positive that is correct). Any advice?
This is what I get btw
{
"error" : "invalid_grant",
"errors" : [ {
"errorCode" : "OAU-222",
"message" : "Account does not exist"
} ],
"error_description" : "Account does not exist"
}
What is your app auth flow, password flow or 3-legged authorization flow?
For authorization flow, see this quick start (using the RingCentral PHP SDK). Is there any reason you don't want to use the SDK?
In your code, you passed the code and other params incorrectly. They must be in the body params, not as query params.
CURLOPT_URL => "https://platform.devtest.ringcentral.com/restapi/oauth/token?code={$authCode}&grant_type={$grant_type}&redirect_uri={$redirect_uri}"
Check the documentation: https://developers.ringcentral.com/guide/authentication/auth-code-flow
Thanks for the heads up. I'm still having a bit of trouble. I can get the authorization code now but I can't seem to get the token. Here is the code that I'm using:
curl_setopt_array($curlpost, array( CURLOPT_URL => "https://platform.devtest.ringcentral.com/restapi/oauth/token?code={$authCode}&grant_type={$grant_type}&redirect_uri={$redirect_uri}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => array( "Accept: application/json", "Content-Type: application/x-www-form-urlencoded", "Authorization: Basic " .$base64test ), ));
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder