kevin-heuple10367 avatar image
kevin-heuple10367 asked Phong Vu commented

Connecting API to Report page

I'm creating a basic API to pull our call logs to a csv. Easy enough except I'm trying to match the format. Right now the call log API extracts all the data exactly as it comes into the 'Call Log' page.

The issue is that our manual process was copying from the 'Call Detail' tab on the Reports page. I can go through the call log json and format everything so that the exported csv is pretty close to the format my only concern there is the logic for the "legs" to produce the same accurate output for the "Users" and "Queue Name" as the Reports page does.

Is there a way to just connect the API directly to the Reports page rather than the call log and formatting the data?

If not how do I set up the Reporting in my sandbox so that I can confirm my output vs the Report page.

rest api
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

brandon-burchard1053 avatar image
brandon-burchard1053 answered John Wang commented
Have you tried scheduling these reports to be emailed as a csv instead of using the API to build this function? Depending on the plan you are subscribed to you should have this option. This is a much easier way and you can generate reports by extensions and email them to any email address. 
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

I'm importing the CSV into our DB and trying to make it entirely automated.

So API runs on a scheduled job > saves last x days of call log to csv on server > job consumes csv and writes data to our database and deletes csv.

0 Likes 0 ·
If the CSV contains everything you need, you can programmatically retrieve the email if you have API access to the account. Standard email accounts generally have IMAP or POP protocol APIs that can be used. Also, if you send it to a developer email service like SparkPost, SendGrid, Mailgun, etc., you may be able to access the email and CSV via REST API. I've used IMAP to programmatically retrieve email in the past and it worked fine.

After you retrieve the email, you need to use a MIME parser to extract the CSV attachment from the email.
0 Likes 0 ·
Phong Vu avatar image
Phong Vu answered Phong Vu commented
Hi Kevin,

Just to confirm with you that there is no API to access the report page as you wish. However, with the call-log API, you can access the same call log dataset and can convert the JSON response to CSV format similar to the one you can download from the service web.

If you extract the format of your current report and let me know which fields you want to add into your db, I can help you write some sample code to convert the JSON response into CSV the way you want.

+ Phong
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thank you. This is the exact information I need to extract and the headers from the report:

The only ones I've having a hard time with are the Users and Queue name. From the json format it looks like the array of legs for each call is formatted something like-
Leg[0] = Main Menu
Leg[1] = Extension or Queue selection
Leg[2] = Person Connected to is Leg[1] was a Queue Selection
0 Likes 0 ·
Hi Kevin,
Sorry for delayed response.
I am not so sure about the fields you want to import to your CVS format. You said that you want it the same as the report which is in my case I see this:
Type,Direction,From,To,Extension,Forwarded To,Name,Date,Time,Action,Action Result,Result Description,Duration,Included,Purchased
Also, in your example, are the from , to, start time on each row from each leg? or from the main response out of the legs object?
0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys