News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

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
Web app with RingCentral API
Tags: getting started
Mar 1, 2018 at 3:21am   •   3 replies  •  0 likes

Hello All,

I am trying to get my C# web application to log into RingCentral using their API. I am new to using Web API, and not sure how to use RC. I have viewed their docs, but I have had no success. | Crystal Reports

I know my credz work, because I can log into their portal, and all my key's have not changed.

First error I receive when adding the "await" key word is it want to change my method from Page_Load to an "async" method. Secondly is page inheritance should this be or

In the end I want to be able to login and retrieve inbound and outbound call logs and display them in a gridview.

I am using VS 2017, and it's a Web Forms app. I did NOT choose MVC or Web API. I can't even break on a break point.

 public partial class _Default : Page
{      //        private static String appKey = ConfigurationManager.AppSettings["appKey"].ToString();      private static String appSecret = ConfigurationManager.AppSettings["appSecretKey"].ToString();      private static bool isProduction = Convert.ToBoolean(ConfigurationManager.AppSettings["IsProduction"].ToString());        private static String userName = ConfigurationManager.AppSettings["username"].ToString();      private static String extension = ConfigurationManager.AppSettings["extension"].ToString();      private static String password = ConfigurationManager.AppSettings["password"].ToString();      private RestClient rc = null;        protected async void Page_LoadAsync(object sender, EventArgs e)      {            rc = new RestClient(appKey, appSecret, isProduction);          await rc.Authorize(userName, extension, password);        }  }

An example web app or stubbed out code for a web app would be very helpful. Thanks, KSS

3 Answers
answered on Mar 1, 2018 at 5:34pm  
If you are uncomfortable with C# async code, please check this:

But if you mix sync and async code, you code will likely to hang:

Overall these are C# knowledge. I can only help you so much. If you have any questions regarding RingCentral feel free to post them.

answered on Mar 1, 2018 at 5:21pm  is a general purpose C# library so it makes no assumption about your app. It could be either a web app or a desktop app.  You just do the authorization first followed by invoking any API endpoints.

Could you please elaborate where are you stuck? Are there any error messages?

Here is how you can do authorization:
Here is how you can list call logs:

answered on Mar 1, 2018 at 5:27am  
We are still using the older SDK package that isn't async and I am not sure how to you can go about making the Page_Load event async but you could:
  1. Remove the async keyword from Page_LoadAsync,
  2. Rename the event handler back to Page_Load
  3. Instead of using await when calling rc.Authorize() you can change that to be rc.Authorize().Result; The Result essentially turns an asynchronous call into a synchronous call.

Also, it looks like the Authorize call is returning a token, since I am not using the newer RC client I am not sure how that token is used but you may need to keep track of that returned token.


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

Developer Platform
Integrated Apps
App Gallery
Developer support
Games and rewards

Resource center
Product Releases
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us