I am trying to use Cloudlink to make a call. I am unable to make the call. It looks like a simple call, but I am getting a bad request. I am including the C# code I used. I am setting the endpoint is that actual extension. I have never verified if that is correct or if this needs to be in Id of some kind. Any help would be appreciated.
public static async Task<object> MakeCall(string token)
{
try
{
// Create an HttpClient instance
using (var httpClient = new HttpClient())
{
// Set headers
httpClient.DefaultRequestHeaders.Add("Authorization", token);
Dictionary<string, object> userData = new Dictionary<string, object>();
userData["to"] = 2214;
// Serialize the input data
var f = Newtonsoft.Json.JsonConvert.SerializeObject(userData);
var jsonContent = new StringContent(f, Encoding.UTF8, "application/json");
// Make the API call
var response = await httpClient.PostAsync("https://media.api.mitel.io/2017-09-01/endpoints/2240/calls", jsonContent);
// Check response status
if (!response.IsSuccessStatusCode)
{
Console.WriteLine(await response.Content.ReadAsStringAsync());
Environment.Exit(1);
}
// Deserialize the response data
var responseData = await response.Content.ReadAsStringAsync();
return responseData;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return null;
}
}