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
code 404 (Not Found) at c#
Tags: getting started
Mar 5, 2019 at 3:32am   •   4 replies  •  0 likes
murylo-batista

I can't get any of the API calls to answer me. it always returns as 404 Not found

Im using the nugget C# library


im using the following code


using RingCentral;


####


string appKey = "MYKEY";

string appSecret = "MYSECRET";

string phoneNumber = "+15178853031";

string password = "MYPASSWORD";

string country = "44";

rc = new RestClient(appKey, appSecret);


await rc.Authorize(phoneNumber, "101", password);


var tokenString = rc.token.access_token;


var extension = rc.Restapi("v1.0").Account("15178853031").Extension("101");


var requestBody = new

{


country = new { id = country },

from = new { phoneNumber = phoneNumber },

to = new object[] { new { phoneNumber = "+4407922204537" } },

playPrompt = "true",


};


var response = await extension.RingOut().Post(requestBody);



what I get is that :

Call failed with status code 404 (Not Found): POST https://platform.devtest.ringcentral.com/restapi/v1.0/account/15178853031/extension/101/ring-out


even using the API page to TRY now, returns that if i set the values for Account and Extension.


any ideas?

4 Answers
answered on Mar 5, 2019 at 5:15pm  
Create a .Net Core app (Core 2.1) and copy paste this code and try it. It should work

using System;
using System.Threading.Tasks;
using RingCentral;
namespace Call_Ringout
{
    class Program
    {
          const string RECIPIENT = "<ENTER PHONE NUMBER>";
          const string RINGCENTRAL_CLIENTID = "<ENTER CLIENT ID>";
          const string RINGCENTRAL_CLIENTSECRET = "<ENTER CLIENT SECRET>";
          const string RINGCENTRAL_USERNAME = "<YOUR ACCOUNT PHONE NUMBER>";
          const string RINGCENTRAL_PASSWORD = "<YOUR ACCOUNT PASSWORD>";
          const string RINGCENTRAL_EXTENSION = "<YOUR EXTENSION, PROBABLY ";
          static void Main(string[] args)
          {
              call_ringout().Wait();
          }
          static private async Task call_ringout()
          {
              RestClient rc = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, false);
              await rc.Authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD);
              if (rc.token.access_token.Length > 0)
              {
                  var parameters = new MakeRingOutRequest();
                  parameters.from = new MakeRingOutCallerInfoRequestFrom { phoneNumber = RINGCENTRAL_USERNAME };
                  parameters.to = new MakeRingOutCallerInfoRequestTo {  phoneNumber = RECIPIENT } ;
                  parameters.playPrompt = false;
                  var resp = await rc.Restapi().Account().Extension().RingOut().Post(parameters);
                  Console.WriteLine("Call Placed. Call status" + resp.status.callStatus);
              }
          }
      }
}

Remember to install the RingCentral SDK using NuGet package RingCentral.Client (3.0.0) SDK

Hope this helps,

 0
answered on Mar 5, 2019 at 7:52am  
No solution so far, guess I will have to develop for nextiva instead.
T_T

 0
answered on Mar 5, 2019 at 3:57am  
Do you mind trying something new? 
https://medium.com/ringcentral-developers/new-ringcentral-sdk-for-net-a43417b2538c

We are going to announce it today.

It has way better exception reporting mechanism.  Try it and you will know the root cause of "{"Call failed with status code 400 (Bad Request)"

 0
answered on Mar 5, 2019 at 3:43am  
The issue is accountId and extensionId. If you don't know what they are, use "~" as ID. "~" means the currently authorized user.

And to get the IDs, you can rc.Restapi("v1.0").Account("~").Extension("~").Get() and check the response. ID is not number, 101 is extension number.




 0



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