C# REST API Client [closed] C# REST API Client [closed] wpf wpf

C# REST API Client [closed]


Take a look at RESTSharp. Very powerful, and easy to use.

Works on all platforms too: Web, Windows, WCF, Monotouch, Windows Phone


You can just use HttpWebRequest or WebClient to make web requests like you would have with CURL in your PHP client...

If you need to deal with JSON based responses, JSON.Net is a fantastic library.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://a/rest/uri");request.Method = "POST";request.Headers.Add("Authorization: OAuth " + accessToken);string postData = string.Format("param1=something&param2=something_else");byte[] data = Encoding.UTF8.GetBytes(postData);request.ContentType = "application/x-www-form-urlencoded";request.Accept = "application/json";request.ContentLength = data.Length;using (Stream requestStream = request.GetRequestStream()){    requestStream.Write(data, 0, data.Length);}try{    using(WebResponse response = request.GetResponse())    {        // Do something with response    }}catch (WebException ex){    // Handle error}


Also you can use HttpClient in .NET 4.5.
If you are usint .NET 4.0, the HttpClient API is available in Microsoft.Net.Http nuget.