Hi ,
Assuming you are referring to REST API's. You can use WebRequest.Create to call the endpoint. You don't need to use Newtonsoft, to get the JSON response, you can create the classes with the JSON structure (see MyEmailResponse class below) and then use DataContractJsonSerializer for serialization of the response. Sample code below-
dynamics365blogs.com/deserialize-json-data-using-datacontractjsonserializer
==================
var httpWebRequest = (HttpWebRequest)WebRequest.Create(EmailEndPoint);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
// authentication
string encoded = Convert.ToBase64String(
Encoding.GetEncoding("ISO-8859-1").GetBytes(UserName + ":" + Password));
httpWebRequest.Headers.Add("Authorization", "Basic " + encoded);
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
// make sure input is escaped
string json = "{ \"payload\": [{ \"address\": \"" + emailAddress + "\"}], " +
" \"sourceOfTruth\": \"" + EmailSOT + "\"}";
streamWriter.Write(json);
}
// may need to handle exceptions
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var responseText = streamReader.ReadToEnd();
using (MemoryStream DeSerializememoryStream = new MemoryStream())
{
//initialize DataContractJsonSerializer object and pass Student class type to it
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(MyEmailResponse));
//user stream writer to write JSON string data to memory stream
StreamWriter writer = new StreamWriter(DeSerializememoryStream);
writer.Write(responseText);
writer.Flush();
DeSerializememoryStream.Position = 0;
//get the Desrialized data in object of type Student
MyEmailResponse objMyEmailResponse= (MyEmailResponse)serializer.ReadObject(DeSerializememoryStream);
if (objMyEmailResponse.payload[0].attributes.email_exists == "INVALID")
{
throw new InvalidPluginExecutionException("Error: Invalid email address. " + objMyEmailResponse.payload[0].attributes.message);
}
}
}
==================

Hope this helps