C# Code Samples
You can send a request like this:
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri("https://exsell.primeware.com.tr/api/v1/");
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.DefaultRequestHeaders.Add("XApiKey", "MY_VERY_SECRET_API_KEY");
string requestJson = @"{
""airFlowUnits"": 0,
""airFlowEx"": 4100,
""tempEx"": 24,
""rhEx"": 50,
""airFlowSup"": 4100,
""tempSup"": 35,
""rhSup"": 40,
""isSummer"": true,
""altitude"": 0,
""modelCode"": ""M70"",
""profitType"": 0,
""coverType"": 0,
""depth"": 578,
""isDensityConst"": false
}";
using (var content = new StringContent(requestJson, Encoding.UTF8, "application/json"))
{
// Send request.
Task<HttpResponseMessage> responseTask = httpClient.SendAsync(
request: new HttpRequestMessage(HttpMethod.Post, "calculate")
{
Content = content
});
responseTask.Wait();
HttpResponseMessage response = responseTask.Result;
// Write the response body to the console.
if (response.IsSuccessStatusCode)
{
string result = response.Content.ReadAsStringAsync().Result;
Console.WriteLine(result);
}
else
Console.WriteLine(response.StatusCode);
}
}
Console.WriteLine("Please press any key to exit.");
Console.ReadLine();Last updated