Skip to main content
The First Step
March 23, 2023
Question

App graduated from sandbox to production, but when doing API calls, it is still pulling from dev.

The error calls are still coming from the dev environment. We downloaded the JSON credentials and everything. Client ID: SLHi8WXcQKOpMHRv4XTVww

    7 replies

    PhongVu
    Community Manager
    Community Manager
    March 24, 2023

    Make sure to change the app client id, app client secret for the production in your code. And login with the credentials of one of the users under your production account.

    rsharmaThe First StepAuthor
    The First Step
    March 24, 2023

    We did all that. Case: 17947263 details the error.

    PhongVu
    Community Manager
    Community Manager
    March 24, 2023

    What is the error. I don't have access to support cases.

    rsharmaThe First StepAuthor
    The First Step
    March 24, 2023

    App ID: riEXZnJHSe6P_haqc3GsXg~DqXw2ZKMTJyE7du8IpApaA App Name: Analytics Quick Start App App Type: Private App Link: https://ai-developer.ringcentral.com/administration.html#/application/riEXZnJHSe6P_haqc3GsXg~DqXw2ZKMTJyE7du8IpApaA Env: Production Topic: Authentication and authorization Details: Hi Team, We are facing error in trying to connect to production server. Despite changing the credentials to that of production from the development, the calls are still going to the sandbox server instead of production. I am including the .env file and python code below being used for the same. Let us know if you can help with the same. Python Code from ringcentral import SDK import os,sys,json from dotenv import load_dotenv load_dotenv() FROM_DATE = '2023-03-01T07:00:00.000Z' TO_DATE = '2023-03-20T07:00:00.000Z' rcsdk = SDK( os.environ.get('RC_CLIENT_ID'), os.environ.get('RC_CLIENT_SECRET'), os.environ.get('RC_SERVER_URL') ) platform = rcsdk.platform() try: # print(os.environ.get('RC_SERVER_URL') ) platform.login(os.environ.get('RC_USERNAME'), os.environ.get('RC_EXTENSION'), os.environ.get('RC_PASSWORD')) except: sys.exit("Unable to authenticate to platform. Check credentials.") def fetch_aggregate_report( from_time, to_time ): try: options = { "grouping":{ "groupBy":"Users" }, "timeSettings":{ "timeZone": "US/Pacific", "timeRange":{ "timeFrom": from_time, "timeTo": to_time } }, "responseOptions":{ "counters":{ "allCalls":{ "aggregationType":"Sum" } } } } resp = platform.post('/analytics/calls/v1/accounts/~/aggregation/fetch', options) jsonObj = resp.json_dict() except Exception as err: sys.exit("Unable to fetch analytics", err) print(json.dumps(jsonObj, indent=2, sort_keys=True)) fetch_aggregate_report( FROM_DATE, TO_DATE ) .env file # Create an app in the RingCentral Developer Console. Make sure the app has all permissions enabled. # Enter in the credentials for this app into the fields below. # Sandbox # RC_SERVER_URL = 'https://platform.devtest.ringcentral.com' # Production RC_SERVER_URL = 'https://platform.ringcentral.com' RC_CLIENT_ID = 'SLHi8WXcQKOpMHRv4XTVww' RC_CLIENT_SECRET = 'scHsiRIkQfWyyveLKTe6gAcNizBtlxRKmlzkw9fgLEaw' # These credentials are used for password-grant types RC_USERNAME = '+16103745111' RC_PASSWORD = <Account Password> RC_EXTENSION = '789' # This credential is used for JWT-grant types RC_JWT = '' # Used in messaging/quick-start.py # This following phone number will receive a test SMS message SMS_RECIPIENT = '' # Used in voice/quick-start.py # This following phone number will receive a phone call RINGOUT_RECIPIENT = '' # Used in PubNub Quick Start # The following URL cannot be blank when running the PubNub Quick Start. # Its value will have no impact on automated test results. RC_REDIRECT_URL = 'http://localhost:5000/oauth2callback' # Used in voice/call-forwarding.py # The following phone number will be set as a forwarding number. RC_FORWARDING_NUMBER = '' # Used throughout ai/* (Artificial Intelligence API) # The following phone number will be set as a forwarding number. RC_MEDIA_URL = 'https://github.com/ringcentral/ringcentral-api-docs/blob/conv-ai-docs/resources/sample1.wav?raw=true'

    PhongVu
    Community Manager
    Community Manager
    March 24, 2023

    Unfortunately, I have to delete your last post for the following reasons:

    1. The content is not formatted in a way that it could be easily read. No lines, no paragraphs.

    2. The post contains your app sensitive info such as both app client id, client secret and phone number.

    3. Redundant info such as the JWT which is not the grant-type of the concern app.

    I also asked for the error and see no error in the post.

    rsharmaThe First StepAuthor
    The First Step
    March 27, 2023

    App ID: riEXZnJHSe6P_haqc3GsXg~DqXw2ZKMTJyE7du8IpApaA App Name: Analytics Quick Start App App Type: Private App Link: https://ai-developer.ringcentral.com/administration.html#/application/riEXZnJHSe6P_haqc3GsXg~DqXw2ZKMTJyE7du8IpApaA Env: Production Topic: Authentication and authorization Details: Hi Team, We are facing error in trying to connect to production server. Despite changing the credentials to that of production from the development, the calls are still going to the sandbox server instead of production. I am including the .env file and python code below being used for the same. Let us know if you can help with the same. Python Code from ringcentral import SDK import os,sys,json from dotenv import load_dotenv load_dotenv() FROM_DATE = '2023-03-01T07:00:00.000Z' TO_DATE = '2023-03-20T07:00:00.000Z' rcsdk = SDK( os.environ.get('RC_CLIENT_ID'), os.environ.get('RC_CLIENT_SECRET'), os.environ.get('RC_SERVER_URL') ) platform = rcsdk.platform() try: # print(os.environ.get('RC_SERVER_URL') ) platform.login(os.environ.get('RC_USERNAME'), os.environ.get('RC_EXTENSION'), os.environ.get('RC_PASSWORD')) except: sys.exit("Unable to authenticate to platform. Check credentials.") def fetch_aggregate_report( from_time, to_time ): try: options = { "grouping":{ "groupBy":"Users" }, "timeSettings":{ "timeZone": "US/Pacific", "timeRange":{ "timeFrom": from_time, "timeTo": to_time } }, "responseOptions":{ "counters":{ "allCalls":{ "aggregationType":"Sum" } } } } resp = platform.post('/analytics/calls/v1/accounts/~/aggregation/fetch', options) jsonObj = resp.json_dict() except Exception as err: sys.exit("Unable to fetch analytics", err) print(json.dumps(jsonObj, indent=2, sort_keys=True)) fetch_aggregate_report( FROM_DATE, TO_DATE ) .env file # Create an app in the RingCentral Developer Console. Make sure the app has all permissions enabled. # Enter in the credentials for this app into the fields below. # Sandbox # RC_SERVER_URL = 'https://platform.devtest.ringcentral.com' # Production RC_SERVER_URL = 'https://platform.ringcentral.com' RC_CLIENT_ID = 'SLHi8WXcQKOpMHRv4XTVww' RC_CLIENT_SECRET = 'scHsiRIkQfWyyveLKTe6gAcNizBtlxRKmlzkw9fgLEaw' # These credentials are used for password-grant types RC_USERNAME = '+16103745111' RC_PASSWORD = <Account Password> RC_EXTENSION = '789' # This credential is used for JWT-grant types RC_JWT = '' # Used in messaging/quick-start.py # This following phone number will receive a test SMS message SMS_RECIPIENT = '' # Used in voice/quick-start.py # This following phone number will receive a phone call RINGOUT_RECIPIENT = '' # Used in PubNub Quick Start # The following URL cannot be blank when running the PubNub Quick Start. # Its value will have no impact on automated test results. RC_REDIRECT_URL = 'http://localhost:5000/oauth2callback' # Used in voice/call-forwarding.py # The following phone number will be set as a forwarding number. RC_FORWARDING_NUMBER = '' # Used throughout ai/* (Artificial Intelligence API) # The following phone number will be set as a forwarding number. RC_MEDIA_URL = 'https://github.com/ringcentral/ringcentral-api-docs/blob/conv-ai-docs/resources/sample1.wav?raw=true'

    PhongVu
    Community Manager
    Community Manager
    March 27, 2023

    I have to delete the new post again. The same problem as I wrote earlier.

    Please submit a dev support ticket from here