There are numerous ways to send an http request without curl.
Most common these days is the HttpClient
class.
For example,
// at the top of the file
using System.Net.Http;
using(var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("X-AUTH-TOKEN", "xxxxxx");
var result = await client.PostAsync("https://azure.qubole.com/api/v2/clusters/", new StringContent("{\"query\":\"show tables;\", \"command_type\": \"PrestoCommand\"}", Encoding.UTF8);
var responseJson = await result.Content.ReadAsStringAsync();
}
Update When you are starting with c#, if you simply pasted this into Program.cs
Main method, you would get the following error:
The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
One way to solve it is to put all of the code above into a method like so
async Task DoWork()
{
// my code above here
}
And then paste this to Main
method:
DoWork().GetAwaiter().GetResult();