question

Albin Hamilton - Acting Senior IT Support Speciali(M-F) 9 TO 6PM CST avatar image

400 Error using Production Call log API

Hi Yesterday I created an app using the call log API and I was able to test it using the sandbox environment. I was able to get the app graduated with multiple requests. I Made all the changes in my code to include the credentials for the production environment and I am getting 400 error which make me think there is an issue with the user credentials. I did notice that the production environment is using an extension that is not mine, it belongs to one of our super users. Do I need to use the password for that extension, or can I use the password of my extension to run the script.
Is there any way to change the extension to mine ?

extension
1 |3000

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

Phong Vu avatar image
Phong Vu answered

What endpoint do you call, the user call log or the account call log? If you call the account call log endpoint, you must authenticate the app with a super admin user, or a custom user role that include the access account call log user permission.

To make sure that your code works well, just call the user call log with the tilde "~" at the extension id in the path. I.e. "/restapi/v1.0/account/~/extension/~/call-log"

1 |3000

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

Albin Hamilton - Acting Senior IT Support Speciali(M-F) 9 TO 6PM CST avatar image
Albin Hamilton - Acting Senior IT Support Speciali(M-F) 9 TO 6PM CST answered Phong Vu commented

@Phong Vu Thank you for the help , this is the End point im calling:

resp = platform . get ( '/restapi/v1.0/account/~/extension/~/call-log' , params )


Using this end point requires me to authenticate the app with a super admin user right ?

1 comment
1 |3000

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

Phong Vu avatar image Phong Vu ♦♦ commented ·

No, this endpoint is for reading the user call log data and the user is the one being authenticated.

Double check the app credentials for production and make sure the username and password is of the user under your production account.

If you still get the 400 status, post the query params so I can have a look at it.

0 Likes 0 ·
Albin Hamilton - Acting Senior IT Support Speciali(M-F) 9 TO 6PM CST avatar image
Albin Hamilton - Acting Senior IT Support Speciali(M-F) 9 TO 6PM CST answered Phong Vu commented
Thank you , I was able to retrieve my call log using my extension and password ( Ext 235) . I can see the production app is under a different extension(102) that is not mine. It belongs to another super admin, is there anyway to modify the extension in the app so that it uses mine ? that way i will be able to retrieve the information i need Or maybe there's something wrong with my parameters.

This is my code :

import json
from pprint import pprint

from ringcentral import SDK

with open('Ringcentral_call_log_Api\secrets.json') as f:
    secrets = json.load(f)
 
rcsdk = SDK(secrets['clientId'], secrets['clientSecret'], secrets['server'])
platform = rcsdk.platform()
platform.login(secrets['username'], secrets['extension'], secrets['password'])
 
params = {
     #'extensionNumber': '<ENTER VALUE>',
    #'showBlocked': true,
    #'phoneNumber': '<ENTER VALUE>',
    #'direction': [ 'Inbound', 'Outbound' ],
    #'sessionId': '<ENTER VALUE>',
    #'type': [ 'Voice', 'Fax' ],
    #'transport': [ 'PSTN', 'VoIP' ],
    #'view': 'Simple',
    #'withRecording': true,
    #'recordingType': 'Automatic',
    #'dateTo': '<ENTER VALUE>',
    #'dateFrom': '<ENTER VALUE>',
    #'page': 000,
    #'perPage': 000,
    #'showDeleted': true
    'perPage': 1000
}
 
resp = platform.get('/restapi/v1.0/account/~/extension/~/call-log', params)
pprint(resp.json_dict())
2 comments
1 |3000

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

This are my app credentials tempsnip.png

0 Likes 0 ·
tempsnip.png (21.5 KiB)
Phong Vu avatar image Phong Vu ♦♦ Albin Hamilton - Acting Senior IT Support Speciali(M-F) 9 TO 6PM CST commented ·

No, don't rely on that info. It's just the default value and your the extension number in your account may change.

Try login your app with a user's direct number and password, then you don't need to specify the extension number at all.

It's your account, you should be able to login your account admin portal with an admin user and see other user extensions info.

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