"Parameter accountId is required in most of the API resources, may I know what is the account Id in sandbox account? Or where is it found?"
--------------------------------------------------------------------------------------------------------------------------------
The RingCentral service allows its customers to create and register an account that is usually associated with the customer's company. After registering the account with the company main number the user can create extensions of different types and functionality. The extensions can further be assigned with the phone numbers and phone devices.
All the account related link could be looked up in the "Exploring Account and Extension settings" section of our Developers guide here
https://developer.ringcentral.com/api-docs/latest/index.html#!#ExploringAccount.html
AK, Official Rep
-
4,402 Points
- informative
Posted 4 years ago
Anton Nikitin, Official Rep
-
2,974 Points
GET https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/messsage-storeMore details can be found here: http://developer.ringcentral.com/api-docs/latest/index.html#!#Resources.html
-
106 Points
AK, Official Rep
-
4,402 Points
Get Extensions ( API Endpoint )
This API returns the list of extensions created for a particular account. All types of extensions are included in this list. Every extension is associated with a parameter named id, for more information you can take a look at the sample request and response here:
https://developer.ringcentral.com/api-docs/latest/index.html#!#RefExtensionList.html
-
106 Points
AK, Official Rep
-
4,402 Points
Does this API endpoint grab all extensions and account id's for all rc users or is it for the user logged in?One or more extensions exist under an Account. Lets say you have an Account named 'A' and all the extensions under this account would look like as below :
Account A
- Ext 101 or User 1
- Ext 102 or User 2
- Ext 103 or User 3 etc
Below is the sample API Request and response :
API Request
GET /v1.0/account/{accountId}/extensionNote: The {accountId} == ~ would refer to the account to whihc the extension belongs to.
API Response
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/1234567/extension?page=1&perPage=100&quo...;,
"records": [
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/1234567/extension/1024935020";,
"id": "<<extensionID for 101>>",
"extensionNumber": "101",
"contact": {
"firstName": "Extension number 101",
"email": "sample.test@company.com",
"pronouncedName": {
"type": "Default"
}
},
"name": "Message-Only-Extension",
"type": "Voicemail",
"status": "Enabled",
"permissions": {
"admin": {
"enabled": false
},
"internationalCalling": {
"enabled": false
}
},
"profileImage": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/1234567/extension/1024935020";
}
},
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/1234567/extension/1024935020";,
"id": "<<extensionID for 102>>"
"extensionNumber": "102",
"contact": {
"firstName": "Extension name for ",
"lastName": "Notification",
"company": "RC",
"email": "sample.test@company.com",
"emailAsLoginName": true,
"pronouncedName": {
"type": "TextToSpeech"
}
},
"name": "AWS Notification",
"type": "User",
"status": "Enabled",
"permissions": {
"admin": {
"enabled": false
},
"internationalCalling": {
"enabled": true
}
},
"profileImage": {
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/1234567/extension/1024935020";,
}
},
}
-
106 Points
Here is my scenario: I have written an automated process that will need to go and check each of our ring central users one by one and all their associated extensions for messages and attachments and download them to our servers here locally for use in our business processes. This automated process would need to cycle through all user accounts to do this so no one individual will be logged in. Rather a super account would be running this process and retrieving the data. Is it possible to do this? All I need are all the account ids for each of our uses but in order to do this it seems that I'd have to run the api (via the code I've written as and installed service on each system) from each users machine under their id to get that account. All I need is a list of the account ids to have my automated process cycle through and retrieve the data but it doesn't seem to be possible unless I have the process run from each user's machine under their id and retrieve that data.
AK, Official Rep
-
4,402 Points
To this you need the following at a high level:
- A public app as a private app can only connect to the owner's account, not other accounts. In the Developer Portal, ensure your app's scope is set to Public.
- A UI that uses RingCentral's 3-legged OAuth 2.0 authorization flow, either the Authorization Code or Implicit Grant flow. To retrieve data for all users in an account, you either need (a) an admin to authorize your app for each account or (b) each user to authorize your app.
- After the user authorizes the account, you will receive an access token representing that user's authorization of your app. At this point you can retrieve a list of all user extensions from the account extension endpoint: /restapi/v1.0/account/~/extension . Technically, you do not need to explicitly use the accountId in API calls since the "~" shorthand notation will represent the current account for the access token, but if you want it, you can retrieve the accountId from the /restapi/v1.0/account/~ endpoint.
- With an access token for each account, just cycle through the accounts and each account's extensions.
- Authorization Code Flow using OAuth2.0 :
https://devcommunity.ringcentral.com/ringcentraldev/topics/using-oauth-2-0- authorization-code-grant-...
- Get Accound ID :
Per this API endpoint, you would need to provide tilde (~) to get the account information as below :
/v1.0/account/{accountId}
- Get all Extensions under the account :
Get Extensions ( API Endpoint )
Benefits of Implementing this architecture :
- No need to run the process from each users machine
- A consistent and trusted UI
- Integrated password reset
- Integrated single sign-on (SSO) via SAML support
Tyler Long, Official Rep
-
8,916 Points
Please clarify your situation and your question if you need further help.
-
106 Points
Here is what my error log is indicating:
2017-09-27 14:06:47,478 [10] ERROR PRIS.RingCentral.MessagesService - Message:
Request rate exceededSource:
RingCentralMethod Causing Error:
Void .ctor(System.Net.Http.HttpResponseMessage, System.Net.Http.HttpRequestMessage)Stack Trace:
at RingCentral.Http.ApiResponse..ctor(HttpResponseMessage response, HttpRequestMessage request)
at RingCentral.Platform.Send(HttpMethod httpMethod, Request request)
at RingCentral.Platform.Get(Request request)
at PRIS.RingCentral.MessagesService.GetAttachmentContent(ParamsForContentDownloads downloadParams, String& result) in c:\Projects\DotNet\PRIS-Framework\PRIS-Framework\PRIS.RingCentral\Services\MessagesService.cs:line 106
Here is where I make the call in MessagesService.cs:line 106
var txtToBytes = Encoding.UTF8.GetBytes(string.Format("{0}:{1}", Settings.AppKey, Settings.AppSecret));
string encodedText = Convert.ToBase64String(txtToBytes);
// Create request with proper authorization.
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, downloadParams.Attachment.Uri);
request.Headers.TryAddWithoutValidation("Content-Type", @"application/x-www-form-urlencoded;charset=UTF-8");
request.Headers.Add("Authorization", string.Format("Basic {0}", encodedText));
// Handle response
var response = Client.RcPlatform.Get(new Request(request.RequestUri.AbsolutePath));
// Get extension type
result = ExtensionHelpers.GetDefaultExt(response.Headers.ContentType.MediaType);
// Get the binary
return Encoding.ASCII.GetBytes(response.Body);
What is strange is that I get a file with varying sizes in kb, but there is not content. For example when I open a pdf, it's blank or if I attempt to open a sound file, it doesn't play anything. Am I handling this correctly?
Tyler Long, Official Rep
-
8,916 Points
Tyler Long, Official Rep
-
8,916 Points
Related Categories
-
Getting Started
- 211 Conversations
- 74 Followers
-
APIs
- 848 Conversations
- 161 Followers