Here you are. Run this script every 15 mins or put it in a loop to call every 15 mins.
from ringcentral import SDK
from credentials import *
import time, json
from time import sleep
from datetime import datetime
rcsdk = SDK( RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER)
platform = rcsdk.platform()
platform.login(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD)
now = time.time()
less15Mins = now - (60 * 1
dateFrom = datetime.utcfromtimestamp(less15Mins).strftime('%Y-%m-%dT%H:%M:%S.000Z'
# use the perPage to control your reading block. max is 1000 items
params = {
'dateFrom': dateFrom,
'perPage': 1000
}
resp = platform.get('/restapi/v1.0/account/~/extension/~/call-log', params)
print ((resp.json()))
run = True
while run:
try:
nextPage = resp.json().navigation.nextPage
print (nextPage.uri)
resp = platform.get(nextPage.uri)
for record in resp.json().records:
print ("Call type: " + record.type)
nextPage = resp.json().navigation.nextPage
sleep(1.2)
except:
print("not found")
run = False