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. https://github.com/ringcentral/ringcentral-csharp-client | 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 System.web.ui.page or Ringcentral.page?
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
{ //https://github.com/ringcentral/ringcentral-csharp-client 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
But if you mix sync and async code, you code will likely to hang: https://stackoverflow.com/questions/14526377/why-does-this-async-action-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.
Could you please elaborate where are you stuck? Are there any error messages?
Here is how you can do authorization: https://github.com/ringcentral/ringcentral-csharp-client#authorization
Here is how you can list call logs: https://github.com/ringcentral/ringcentral-csharp-client#list-all-of-the-inbound-call-logs
- Remove the async keyword from Page_LoadAsync,
- Rename the event handler back to Page_Load
- 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