lundi 20 novembre 2017

C# web app with RingCentral API

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. http://ift.tt/2zThpE1

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
{
    //http://ift.tt/2zThpE1

    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);

    }
}

Thanks, KSS




Aucun commentaire:

Enregistrer un commentaire