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
How can I download call log between two defined date using python or Js
Tags: getting started
Jun 18, 2018 at 9:10am   •   2 replies  •  0 likes
atik-r

Hi, I have my APP_KEY, APP_SECRET, USERNAME, PASSWORD.

I have also a little knowledge of python. I want to download detail call log without fax and Inbound calls between two defined date.

Any idea or sample script will be very helpful for me.

Thanks

2 Answers
answered on Jun 19, 2018 at 5:46am  
Hi Sir, 
Thanks for your help with the code, I have tried but getting an error, Actually I am confused where I need to put my login details and secret keys etc. Here I have added my code and error found. 
Thanks

Here is my code sample:  
import os
from dotenv import load_dotenv
load_dotenv(dotenv_path=os.getenv('ENV_PATH'))

from ringcentral import SDK

sdk = SDK(
os.getenv('MyClientId'),
os.getenv('Mysecret Key'),
os.getenv('https://platform.devtest.ringcentral.com'))

platform = sdk.platform()
platform.login(
os.getenv('MyUsername'),
os.getenv('MyExtention'),
os.getenv('MyPassword'))


try:
from urllib import urlencode
except: # For Python 3
from urllib.parse import urlencode

query = {
'dateFrom': '2018-05-01T00:00:00Z',
'dateTo': '2018-06-01T00:00:00Z',
'direction': 'Outbound',
'type': 'Voice',
'view': 'Detailed'}

qs = urlencode(query)

res = platform.get('/restapi/v1.0/account/~/extension/~/call-log?'+qs)
print(res.text())

Here is the error: 
Traceback (most recent call last):
  File "C:/Python34/Ringcentral.py", line 20, in <module>
    os.getenv('MyPassword'))
  File "C:\Python34\lib\site-packages\ringcentral\platform\platform.py", line 105, in login
    raise e
  File "C:\Python34\lib\site-packages\ringcentral\platform\platform.py", line 82, in login
    raise Exception('Either code or username with password has to be provided')
Exception: Either code or username with password has to be provided

 0
answered on Jun 18, 2018 at 11:06am  
When making a call to the call-log end point, set the following query parameters:

  • dateFrom
  • dateTo
  • direction = 'Outbound'
  • type = 'Voice'
  • view = 'Detailed'

See this example in Python here:

https://github.com/grokify/ringcentral-python-examples/blob/master/demo_call-log.py

 1



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