[Solved] How to call third party Restful API [closed]


The problem is that you are mixing up options of the library with HTTP headers. Try with this instead:

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-Api-Key"] = "key";
        client.Headers["X-Api-Secret"] = "secret";

        string s = client.DownloadString(url);
        Console.WriteLine(s);
    }
}

You might want to look into the recommended HttpClient if you can use .NET 4.5 or newer.

1

solved How to call third party Restful API [closed]