I'm building a Windows Phone 7 Silverlight app. Is there any reason to use RestSharp instead of WebClient? I've looked around on the RestSharp site, but it's not immediately obvious what the benefits are.
Asked
Active
Viewed 4,792 times
13
-
1The reader may take a look at [differences between RestSharp and ServiceStack](http://stackoverflow.com/questions/10117376/) where the lead of service stack and user Runscope API Tools - the former lead of restsharp [1](http://john-sheehan.com/blog/my-net-open-source-project-management-nightmare), [2](http://haacked.com/archive/2013/09/18/restsharp-104-2-0-released.aspx) - give a recommendation about these two options. – surfmuggle Nov 04 '13 at 20:57
-
1The article http://www.diogonunes.com/blog/webclient-vs-httpclient-vs-httpwebrequest/ recommends HttpClient for .Net 4.5+ – Michael Freidgeim Jan 24 '16 at 12:18
1 Answers
21
RestSharp removes the following pain points:
- Quirks in .NET's HTTP classes (basic authentication is broken, error handling for non-200 responses, etc)
- Automatic deserialization from response data to POCOs
- Simplified API (
request.AddParameter(name, value)
instead of manually compiling request bodies - Simplified request/response semantics, especially for async (however, it's opinionated for async and may not meet everyone's needs, in which case I would also suggest evaluating Hammock)
Deserialization is probably the biggest gain since for most APIs you don't have to do very much to get the XML or JSON into your C# objects.
I would check out these pages for more info
https://github.com/restsharp/RestSharp/wiki https://github.com/restsharp/RestSharp/wiki/RestSharp-Blog-Posts-and-Links
Feel free to post any questions here or on the Google Group

John Sheehan
- 77,456
- 30
- 160
- 194
-
-
Hi John, please confirm, can Restsharp be used in windows service? Or WinHttp the only option? – ivorykoder Sep 22 '16 at 13:22