Anubhav
Anubhav
CC#
Created by Anubhav on 7/18/2024 in #help
Hey guys this is my service file :
Thank you so much guys let me try and come back to you
23 replies
CC#
Created by Anubhav on 7/18/2024 in #help
Hey guys this is my service file :
var content = new StringContent("{\r\n "phone_number": "+91**",\r\n "task": "Say Hello Anubhav How are you",\r\n "voice" : "maya"\r\n}", null, "application/json");
request.Content = content;
var content = new StringContent("{\r\n "phone_number": "+91**",\r\n "task": "Say Hello Anubhav How are you",\r\n "voice" : "maya"\r\n}", null, "application/json");
request.Content = content;
23 replies
CC#
Created by Anubhav on 7/18/2024 in #help
Hey guys this is my service file :
@ZZZZZZZZZZZZZZZZZZZZZZZZZ Sir i'm calling an URL inside my API there i was giving hardcoded value of phone number and task as you can see i want to modify this code such that on my swagger i can manually put any phone number or task there in my swagger
23 replies
CC#
Created by Anubhav on 7/18/2024 in #help
Hey guys this is my service file :
public async Task CallThirdPartyApiAsync(string phoneNumber)
{
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.bland.ai/v1/calls");
request.Headers.Add("Authorization", "JAQERTYUIOPSDFGHJKLZXCVBNMRTEIOUYSDFGHJKLZXCVBNMRTEIOUYSDFGHJKLZXCVB");

var content = new StringContent("{\r\n "phone_number": "+91**",\r\n "task": "Say Hello Anubhav How are you",\r\n "voice" : "maya"\r\n}", null, "application/json");
request.Content = content;

var response = await _httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();

var responseContent = await response.Content.ReadAsStringAsync();

// Deserialize the response content into a CallerId object
var callerId = JsonConvert.DeserializeObject<CallerId>(responseContent);

// Save the CallerId object to the database
_context.callerid.Add(callerId);
await _context.SaveChangesAsync();
}
public async Task CallThirdPartyApiAsync(string phoneNumber)
{
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.bland.ai/v1/calls");
request.Headers.Add("Authorization", "JAQERTYUIOPSDFGHJKLZXCVBNMRTEIOUYSDFGHJKLZXCVBNMRTEIOUYSDFGHJKLZXCVB");

var content = new StringContent("{\r\n "phone_number": "+91**",\r\n "task": "Say Hello Anubhav How are you",\r\n "voice" : "maya"\r\n}", null, "application/json");
request.Content = content;

var response = await _httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();

var responseContent = await response.Content.ReadAsStringAsync();

// Deserialize the response content into a CallerId object
var callerId = JsonConvert.DeserializeObject<CallerId>(responseContent);

// Save the CallerId object to the database
_context.callerid.Add(callerId);
await _context.SaveChangesAsync();
}
23 replies