How could we call the below endpoints in C# webClient, I have managed this with GoogleScript but now I need it in C#
var options = {
"async": true,
"crossDomain": true,
"method" : "GET",
"headers" : {
"X-Api-Key" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"X-Api-Secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
};
var response = UrlFetchApp.fetch('https://dashboard.reviewpush.com/api/company/locations',options);
var pages = JSON.parse(response.getContentText());
how we can pass headers with multiple values to the request, the code that i have tried is to as below
public static void Main (string[] args)
{
string url = "https://dashboard.reviewpush.com/api/company/locations";
using (var client = new WebClient())
{
client.Headers[HttpRequestHeader.ContentType] = "application/json";
client.Headers["X-IFORM-API-REQUEST-ENCODING"] = "JSON";
client.Headers["async"] ="true";
client.Headers["crossDomain"] = "true";
client.Headers["method"] = "GET";
client.Headers["headers"] = "{'X-Api-Key' : 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'X-Api-Secret': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
}";
Stream data = client.OpenRead (args[0]);
StreamReader reader = new StreamReader (data);
string s = reader.ReadToEnd ();
Console.WriteLine (s);
data.Close();
reader.Close();
}