News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Raw JSON to view call logs so I can see individual call recordings
Tags: call recordings
Dec 9, 2020 at 7:10am   •   7 replies  •  0 likes
Matthew Herbert

Hi there

I am extremely new to this forum. I have signed up to the sandbox environment and wish to create some raw JSON to firstly "pass" a given telephone number and then to receive a response back with all the call recordings/call log list based on that telephone number. I have worked with raw JSON before but after extensive reading in the documentation I cannot see how to get started with the API. I want to use password flow authentication because I have solely created a CRM application (server-side application in the cloud) which will be doing the processing work, as opposed to a physical user. Ultimately all I want to do is allow my CRM application automatic"permission" to access the API and access the call recordings/log by passing the API a telephone number so I can then see the individual call recording IDs for that telephone number so ultimately a user in my CRM can play a call recording.

I believe the POST URL I need to access the API with password flow is as follows (an example):


Authorization: Basic cmVsLWFsbC1wZXJtaXNzaWXFjMmpRZmlQcnlkSUkweE92QQ== grant_type=password&username=18559100010&extension=101&password=121212

The username is the telephone number I was assigned when I signed up to the sandbox account and the password is my password I use to log into the sandbox account. However I am not sure what "cmVsLWFsbC1wZXJtaXNzaWXFjMmpRZmlQcnlkSUkweE92QQ" is in the example above which is provided by the documentation? Nor do I know what my "extension" is. Is this my extension or the telephone number I want to "pass" to the API in order to get the call logs belonging to that telephone number?

I do not have an account id too which is needed for other forms of authentication. My account manager says I will not get an account id until I send my application off to RingCentral for review and once accepted only then will I get an account ID?? My application is completely secure and server-side. It would be impossible to "send off" to anyone as it is an entire CRM application. That aside I think I can get it working by using the password flow authentication (as long as I don't need the account ID parameter at a later time?)


However I am stuck on how to "pass" the API a telephone number and get the response back with the resultant call log with each call recording ID belonging to that telephone number. Ultimately I need the call recording ID's so my user can play a call recording on the front end. I cannot find a clear example of simple working code in raw json to start working on my project . Please can anyone help?

Thank you very much for any help. I really appreciate it.

Matt

7 Answers
answered on Dec 21, 2020 at 1:30am  

@Anirban please can you tell me how I can use Postman to "pass" an example telephone number and pass an example "dateFrom" to my app so I can return the call log only for that telephone number for all results received on or after the specified "dateFrom" value? Currently I am able to return the whole entire call log but I want to be able to query and filter to show all results in the logs for a particular telephone number and dateFrom value and even dateTo value if possible.

Thank you for any help. I really appreciate it.


 0
answered on Dec 15, 2020 at 7:34am  

Anirban, please can you tell me if you know how I can create an app which uses "Auth Code" as the authentication method, which does not need/require a real user to login on a login page? I do not want a real person to have to login on a login page. My CRM software automatically authenticates on the app I have created using Password flow which works perfectly . My problem is I need to make my app available to Avaya Cloud Office (public) but in doing so my app cannot use Password Flow and am only allowed to use Auth Code. I only want my app available to my internal staff who use our Avaya Cloud Office phone system.

Thank you very much for any help.


 0
answered on Dec 11, 2020 at 4:35am  

@Anirban Thank you. I will use the clone option next time.

It's working and can get my account ID by using the access token I received earlier. I am now trying to access the Call Log. I have downloaded RingCentral's soft phone desktop application and have made an INBOUND call using my cell/mobile phone to my developer test telephone number, which works, and I have recorded two or three inbound calls. I cannot make test outbound calls because I'm on a test developer account. My app has Read Call Log permission .


When I run the following GET command:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/call-log HTTP/1.1


And use the following headers:

Content-Type: application/json 
Accept: application/json 
Authorization: Bearer <MY ACCESS TOKEN> 
Host: platform.devtest.ringcentral.com

Nothing entered in the Body.

When I click Send in Postman I get the following error message:

{     "errorCode": "AGW-404",     "message": "Resource not found",     "errors": [] 
}



 0
answered on Dec 10, 2020 at 9:09am  

Thank you for your help with this. I really appreciate it.


 0
answered on Dec 10, 2020 at 8:04am  

@Anirban How do I carry out the part you suggested to get my account number and extension:


"https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~ " Where do I run this? I have Postman so can run test code there. But surely I need something to unique to identify me in order to run this generic line of code?


 0
on Dec 10, 2020 at 8:14am   •  1 likes

This is a GET method you can run in postman with the url.

You just need to pass access token you got it from previous https://platform.devtest.ringcentral.com/restapi/oauth/token call

Once you get the token you call GET https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~ and pass the access token in Header :-

Authorization Bearer <access_token>

You will get a response something like this example:

{
    "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/123456789/extension/987654321",
    "id": 123456789,
.....

123456789 will be account id and 987654321 will be extension id

answered on Dec 10, 2020 at 7:40am  

Does anyone have any working examples of accessing a call log by passing a telephone number querystring and the individual call recordings related to that telephone number?


 0
answered on Dec 9, 2020 at 10:10am  

Thank you for your help Anirban. I will give it a go and see how I get on.


 0
answered on Dec 9, 2020 at 7:52am  
 cmVsLWFsbC1wZXJtaXNzaWXFjMmpRZmlQcnlkSUkweE92QQ== 

is the Base 64 encoding of your Client id and Client secret you need to encode in format of

Authorization Basic <clientId:clientSecret in Base64>

This is require to pass as authentication to get Oauth token. You will get the clent id and client secret in credentials section of your app.

You can check your account id number with this following API:

"https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~"

You will get account id and extension id in response


 1
on Dec 10, 2020 at 9:45am   •  0 likes

Hi I am sorry but I have another question please: in your comment above

  
  1. cmVsLWFsbC1wZXJtaXNzaWXFjMmpRZmlQcnlkSUkweE92QQ== 

is the Base 64 encoding of your Client id and Client secret you need to encode in format of

  
  1. Authorization Basic <clientId:clientSecret in Base64>



I have got my client ID and client secret from my app settings. Please can you tell me how I pass this to Postman - do I POST it like follows:

Authorization: Basic <MY CLIENT ID>:<MY CLIENT SECRET>== grant_type=password&username=18559100010&extension=101&password=121212

(Replacing MY CLIENT ID with my client ID and replacing MY CLIENT SECRET with my client secret? So both the client id and client secret are just separated by a colon ":"? I have tried to "POST" this in Postman but without success. When I have used Postman before the POST field normally only takes one line, normally in the form of a URL with querystrings or query parameters.

Thank you for any help.

on Dec 10, 2020 at 10:00am   •  1 likes

Simple example... suppose your client id is abcdefgijklmnoaczxcxzccd and client secret is efghijk123rtyui, got to https://www.base64encode.org/ and select encode...

put the value abcdefgijklmnoaczxcxzccd:efghijk123rtyui there separated by colon.

When you press encode button, you will get encoded value:

YWJjZGVmZ2lqa2xtbm9hY3p4Y3h6Y2NkOmVmZ2hpamsxMjNydHl1aSA=

Now you can use this value in Header as

Authorization   Basic YWJjZGVmZ2lqa2xtbm9hY3p4Y3h6Y2NkOmVmZ2hpamsxMjNydHl1aSA=

in body pass:

username=+18559100010&password=121212&extension=101&grant_type=password

url: https://platform.devtest.ringcentral.com/restapi/oauth/token (if you are using Sandbox)


You will able to generate access_token in response which you can pass in other APIs as Bearer type

Authorization Bearer <access_token>  

example

pass it in "https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~ " call as header

on Dec 10, 2020 at 10:13am   •  0 likes

Thank you so much for your answer. That was really helpful and I am now getting it to work however my Postman error is saying the following:


{

"error" : "unauthorized_client",

"errors" : [ {

"errorCode" : "OAU-251",

"message" : "Unauthorized for this grant type"

} ],

"error_description" : "Unauthorized for this grant type"

}


I have checked and double checked the BODY line in Postman:

username=+<MY PROVIDED TEL NUMBER>&password=<MY PASSWORD TO LOGIN TO SANDBOX>&extension=101&grant_type=password

I can login fine with the credentials when logging into the RingCentral Sandbox web page but it may be a syntax issue in Postman.

on Dec 10, 2020 at 10:38am   •  1 likes

Have you passed the header as discussed :

Authorization   Basic <base 64 client id: base 64 client secret>

Also make sure your apps support password flow grant type and not other grant type in developer portal

on Dec 11, 2020 at 1:41am   •  0 likes

Thanks @Anirban I think I have passed the Authorization header correctly.

Authorization   Basic <base 64 client id: base 64 client secret>

I suspect the problem is my app not allowing password flow grant type. The problem is I cannot see any option to "edit" my app to find out or change it. Please is it possible to tell me how I can edit my app to check or do I have to start from scratch and create a new app?


Thank you again for your help.

on Dec 11, 2020 at 1:48am   •  0 likes

I think I have to create the app again from scratch. It won't take too long. When I went into view my app settings I could see this:

"Details can't be edited once the app is created."

And underneath this there is "Available Auth Flows" and Password has a red X against it so this would be my likely cause of my error as you suggested. I will recreate my app and see how I get on. Thank you again for your help.


on Dec 11, 2020 at 3:08am   •  0 likes

It's worked! Thank you so much Anirban. I can now see the access_token.

on Dec 11, 2020 at 3:58am   •  0 likes

There is a option called clone app... You can clone the app and not need to create from scratch



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

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us