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
Admin API Account
Tags: rest api
Jun 7, 2020 at 11:40am   •   2 replies  •  1 likes
James Peragine

How can I setup an Admin account that can access records for all agents in an API call?

I want to get ALL records for from ALL agents for a phone number. ie. if I want to return all SMS messages that were sent to a phone number company wide.

Right now I have to provide credentials for a specific agent and it will only return Calls or SMS message that were sent from that one agent.

2 Answers
answered on Jun 8, 2020 at 3:56pm  

Nice I will work on getting this implemented this evening.


Can the same thing be accomplished using the API with a CURL command and putting the Super Admins login details in the header?


 0
answered on Jun 8, 2020 at 7:14am  

Login your app with an Admin user (user extension with the Super Admin role. E.g. the default 101 extension). Read account extension and parse the response to make a list of extension ids (Note: extension id, NOT extension number!). Then read the message store of each extension by specifying the extension id for that extension in the query path. If you have an account with a large number of extensions (> 50 extensions) , do take care of the API rate limit. Here is a snippet code in Node JS, showing how to extensions and read the message store of other extension.

var extensionList = []
function get_extensions() {
  platform.get('/restapi/v1.0/account/~/extension')
      .then(function(resp){
          var jsonObj = resp.json
          for (var record of jsonObj.records){
              extensionList.push(record.id)
          }
          readExtensionMessageStore()
      })
      .catch(function(resp){
          console.log("Something went wrong.")
      })
}

function readExtensionMessageStore(){
  async.each(extensionList,
    function(extensionId, callback){
        var endpoint = '/account/~/extension/'+ extensionId +'/message-store
        platform.get(endpoint, {
                   dateFrom: '2018-01-01T00:00:00.000Z',
                   dateTo: '2018-07-31T23:59:59.999Z',
                   phoneNumber: "1223343434"
                   messageType: 'SMS'
          })
          .then(function (resp) {
            var jsonObj = resp.json()
            console.log(extensionId)
            console.log("=========== EXTENSION MESSAGE STORE ===========")
            console.log(JSON.stringify(jsonObj))
            console.log("+++++++++++++++++++++++++++++++++++++")
          })
          .catch(function(ex){
            console.log(ex.message)
          })
    }
  )
}



 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