question

Caleb Bluesummers avatar image
Caleb Bluesummers asked Caleb Bluesummers commented

C#: Resource for parameter [accountId] is not found

I'm working on a sandbox account, trying to use the Get Extensions API. My code is as follows:


using System;
using System.Threading.Tasks;
using RingCentral;

namespace Send_SMS
{
    class Program
    {
        const string RINGCENTRAL_CLIENTID = "<sandbox-id>";
        const string RINGCENTRAL_CLIENTSECRET = "<sandbox-secret>";

        const string RINGCENTRAL_USERNAME = "<sandbox-username>";
        const string RINGCENTRAL_PASSWORD = "<sandbox-password>";
        const string RINGCENTRAL_EXTENSION = "101";

        const string RINGCENTRAL_PRESENCE_USER = "<sandbox-username>";
        const string RINGCENTRAL_PRESENCE_EXT = "101";


        static RestClient restClient;

        static void Main(string[] args)
        {

            restClient = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, false);
            restClient.Authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD).Wait();
            get_presence().Wait();

        }
 
        static private async Task get_presence()
       {
            var response = await restClient.Restapi().Account(RINGCENTRAL_PRESENCE_USER).Extension().List(listExtensionsParameters);

            Console.WriteLine("Extension for Test Account: " + response);
        }

    }
}


Where anything in <> is taken from the https://developers.ringcentral.com/my-account.html#/application-credentials site.


I was able to do the Send_SMS tutorial successfully, but for this, I'm getting:


Content: {

"errorCode" : "InvalidParameter",

"message" : "Resource for parameter [accountId] is not found",

"errors" : [ {

"errorCode" : "CMN-102",

"message" : "Resource for parameter [accountId] is not found",

"parameterName" : "accountId"

} ],

"parameterName" : "accountId"

}


What am I missing here?

getting started
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Caleb Bluesummers avatar image
Caleb Bluesummers answered Caleb Bluesummers commented


Is this the correct AccountId to use?


When I click your link, I get:


{  "errorCode" : "AGW-404",  "message" : "Resource not found",  "errors" : [ ] }

1596813323176.png (18.4 KiB)
2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Anirban avatar image Anirban commented ·

If you hit the API GET https://platform.devtest.ringcentral.com/restapi/v1.0/account/~ , you will get your account id number in response like below example:

"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/123456789"

123456789 will be then account id

0 Likes 0 ·
Caleb Bluesummers avatar image Caleb Bluesummers Anirban commented ·

I'm able to get the information from using the GET feature in the API-Reference screens, since I have no idea where to run the GET in C#.


This leads to another issue, but I will create a new thread to ask. Thanks!

0 Likes 0 ·
Anirban avatar image
Anirban answered Anirban edited

Maybe the account number you are providing might not actually belong to the Organization or the account itself.

Check the account number and provide the correct number or '~' ( tilde ) should work for the logged-in user.

You can use https://platform.devtest.ringcentral.com/restapi/v1.0/account/~ to get your account id number

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys