Resource for parameter [accountId] is not found

  • 1
  • Problem
  • Updated 8 months ago
  • Solved
hi,

i'm trying to get a customer's calls for the first time, but i get the error message in the subject.

the flow that was used:
1. the customer has authorized my application using the authentication flow (i got an access key using ring central's APIs).

2. using the following API, i tried to get the customer's extensions list, but got the error message.
the url i'm using is -
https://platform.ringcentral.com/restapi/v1.0/account/<ACCOUNT-NUMBER>/extension
(i use an account number, not the '~' sign).

3. i used my account in ring central to check the code i wrote, and noticed that when i use a user, that is defined as an admin in ring central, the APIs work without any problem, but when i use a standard user (not an admin), i also get the error in the subject.

my questions are:
1. when granting access, only an admin user can be used during authentication, in order to grant the access to the customer's data?

2. if a standard user can be used to grant access, then what am i doing wrong?

thanks :)

 
Photo of Gaash Granot

Gaash Granot

  • 206 Points 100 badge 2x thumb

Posted 8 months ago

  • 1
Photo of AK

AK, Official Rep

  • 4,362 Points 4k badge 2x thumb
Hi Gaash,

The GET Extension List API would return the list of extensions created for a particular account. All types of extensions are included in this list.

Now, in order to get the extensions list under an account, you need not be an Admin to make this API request. The GET Extensions List can be retrieved using an Admin or a non-Admin User. 

Based on the description you have provided above, it looks like the <ACCOUNT-NUMBER> that you are providing might not actually belong to the Organization or the account itself.Using a `~` ( tilde ) should work for the logged-in user.

Can you verify if `~` works or not?
Photo of Gaash Granot

Gaash Granot

  • 70 Points
hi

thanks for the reply.
unfortunatelly, the tilde sign won't help, since there's no looged-in user. the API is executed in a fully back-end system, as part of a batch process.

what else can be the cause for the error?
how can it be, that an admin user authorization works, and a stardatd user doesn't?
Photo of John Wang

John Wang, Official Rep

  • 4,714 Points 4k badge 2x thumb
To access customer account data, you need to have a logged in user's access token. You cannot access customer data without such authorization. If you wish to access a user's data you should use OAuth to get an access token for the user and then use that access token to retrieve the user's account data.

Regarding your questions in the OP:

1. when granting access, only an admin user can be used during authentication, in order to grant the access to the customer's data?

It depends on that data in question, but both admin and standard users can retrieve the extension list, e.g. "account/~/extension".

2. if a standard user can be used to grant access, then what am i doing wrong?

From the above, it seems you are trying to access the data without a logged in user's access token, which is necessary. If you have an access token for a standard user and are accessing that user's account, e.g. "account/~/extension" or using the accountId retrieved from "account/~" there is some other issue with the code.
(Edited)
Photo of AK

AK, Official Rep

  • 4,362 Points 4k badge 2x thumb
unfortunatelly, the tilde sign won't help, since there's no looged-in user. the API is executed in a fully back-end system, as part of a batch process. 
What is the user you are Authorizing as to make the API request ? Would that user be a part of the organization / account ?

Per the error, I can think of it as you are authorized as a user A but then the <AccountID> which you are using in the API to retrieve the list of extensions does not belong to the same org / account as the user A
Photo of Tyler Long

Tyler Long, Official Rep

  • 4,992 Points 4k badge 2x thumb
There is a logged-in user as long as you have the access token. "account/~" means the account which contains the user that you used to obtain the access token.

It is true that the access token is unable to fetch information from other accounts. Only fetch information from the current account is possible.
Photo of Gaash Granot

Gaash Granot

  • 206 Points 100 badge 2x thumb
ok, thank you all for your answers.
i checked if the code works when i'm using the '~' sign instead of the account id, using the access token that was created when the standard user granted access, and it worked fine.

then, i checked what was the value of the account id i was using, and it turned out to be ring central owner id. this is actually a bug in my code, but it made me wonder:
how come, that when i used the owner id of an admin user in ring central, it worked fine, and i also managed to get other extensions calls?
how is it possible?

thanks.
Photo of John Wang

John Wang, Official Rep

  • 4,714 Points 4k badge 2x thumb
The extensionId for the Super Admin user (typically extension 101) and the accountId are the same number, while the extensionId for standard users are different than the user's accountId.
(Edited)