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
Using API to Create Message Store Report
Tags: rest api
Dec 15, 2021 at 8:25pm   •   3 replies  •  0 likes
Daniel Padilla

Hello,

I am trying to write a python script to download a voicemail from the developer account I created. Id gone through the API Reference and I found a page on how to do that here: https://developers.ringcentral.com/guide/messaging/message-store/message-exports-report#python


The first step is to create a message store report task and well that's where I'm stuck. I believe the issue is that I need a token to complete this first step because I'm available run the script that returns the list of messages from an extension mailbox found here but I can't generate the report.


I've found a doc that talks about how to get the token however I don't think it applies to the developer account: https://developers.ringcentral.com/engage/digital/guide


Have any of you gotten a token for your scripts? Where do you find it and is it available for the developer account?


If it helps, I'm providing the output I get when I run the message store report script.

screen-shot-2021-12-15-at-80429-pm.png


3 Answers
answered on Dec 17, 2021 at 3:42pm  

Hello,

I've found the issue! The dateTo/From had to be in this format:

2019-07-31T20:01:58Z

I get a successful call to the API now. Thank you!


 0
answered on Dec 16, 2021 at 11:49pm  

Hi Phong,

This is the setting I have set for the app:

screen-shot-2021-12-16-at-112402-pm.png

I've also tried the 3-legged option as well with the "Server-side web app" option selected but I get an Error HTTP 400.

screen-shot-2021-12-16-at-114740-pm.png

This is my code for reference:

from ringcentral import SDK
import json

with open('rc-credentials.json') as data_file:
    data = json.load(data_file)


CLIENTID = data['RINGCENTRAL_CLIENTID']
CLIENTSECRET =  data['RINGCENTRAL_CLIENTSECRET']
SERVERURL = data['RINGCENTRAL_SERVER']
RCUSERNAME = data['RINGCENTRAL_USERNAME']
RCEXTENSION = data['RINGCENTRAL_EXTENSION']
RCPASSWORD = data['RINGCENTRAL_PASSWORD']


rcsdk = SDK(CLIENTID, CLIENTSECRET, SERVERURL)
platform = rcsdk.platform()
platform.login(RCUSERNAME, RCEXTENSION, RCPASSWORD)
response = platform.post(f'/restapi/v1.0/account/705444005/message-store-report', {
        'dateFrom': '2021-12-01',
        'dateTo': '2021-12-30',
        'messageType': ['VoiceMail']
    })

 0
answered on Dec 15, 2021 at 8:44pm  

Since your code fails at authentication and the error was "unauthorized for this grant type", I guessed that your app platform type is not password flow type. The sample code in the message store export is using username and password to authenticate. So login your developer portal and open your app settings to check the platform type. If it's not Server only/ No UI type, then create a new app with that type and retry. Remember also, in order to export the message store, you need to authenticate the app with a user with the super admin role.

For your other observation, there is nothing to do with the Engage Digital so it should not be related. You can also search for "unauthorized for this grant type" from the community to see previously questions and answers.


 0



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