Skip to main content
Solved

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

  • August 7, 2020
  • 1 reply
  • 1474 views

I am trying to pull users presence data in C#

I was able to get the AccountId and the ExtensionId from here:


Here is my code:

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

namespace Send_SMS
{
    class Program
    {
        const string RINGCENTRAL_CLIENTID = "<>";
        const string RINGCENTRAL_CLIENTSECRET = "<>";

        const string RINGCENTRAL_USERNAME = "<>";
        const string RINGCENTRAL_PASSWORD = "<>";
        const string RINGCENTRAL_EXTENSION = "<>";

        const string RINGCENTRAL_PRESENCE_USER = "<>";
        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()
        {

            // OPTIONAL QUERY PARAMETERS
            ReadUserPresenceStatusParameters readUserPresenceStatusParameters = new ReadUserPresenceStatusParameters
            {
                //detailedTelephonyState = true,
                //sipData = true
            };

            var response = await restClient.Restapi().Account(RINGCENTRAL_PRESENCE_USER).Extension(RINGCENTRAL_PRESENCE_EXT).Presence().Get(readUserPresenceStatusParameters);

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

    }
}


Everything in <> is filled out of course, and tested with the SMS_Send tutorial.

My error:

Content: {"errorCode":"CMN-102","message":"Resource for parameter [extensionId] is not found","errors":[{"errorCode":"CMN-102","message":"Resource for parameter [extensionId] is not found","parameterName":"extensionId"}],"parameterName":"extensionId"}


Thanks in advance. I'm really struggling to understand the account/extension side of this API.

Best answer by Anirban2396911020

This is because you are not giving correct extension id number. You can get all the id numbers for all your extensions with this API

GET https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~


It will return response with account id number and extension id number. example:

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


account id number will be 123456789 and extension id number will be 987654321

View original
Did this thread help you find an answer to your question?

1 reply

This is because you are not giving correct extension id number. You can get all the id numbers for all your extensions with this API

GET https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~


It will return response with account id number and extension id number. example:

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


account id number will be 123456789 and extension id number will be 987654321


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings