So I’ve just started out using the RC api, and I’ve got a project going, just a simple little console app to automate user creation and eventually deletion. After going over the documentation, I have a slice of code that it seems should be working, but I’m getting a null reference exception when I actually try to make the api call. Here’s my code:
using System;
using RingCentral;
class Test1
{
static string accountId = "fakeID";
static RestClient rc = new RestClient(
"fakeid",
"fakesecret",
"https://platform.devtest.ringcentral.com"
);
static ExtensionCreationRequest extensionCreationRequest = new ExtensionCreationRequest
{
contact = new ContactInfoCreationRequest
{
firstName = "Test",
lastName = "Sam",
jobTitle = "Test",
email = "test.sam@fakeplace.org",
emailAsLoginName = true,
department = "Test"
},
extensionNumber = "1234",
password = "*****",
type = "User"
};
public static void Main(stringi] args)
{
Response();
Console.ReadLine();
}
private static async void Response()
{
var r = await rc.Restapi().Account(accountId).Extension().Post(extensionCreationRequest);
Console.WriteLine(r.status);
}
}
I’ve scoured the internet looking for more examples of this sort of thing, but there’s not much out there. I can’t figure out what I’m doing wrong.