Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
NOTE: This was cross posted from here .
If you have a need to consume REST Services from .NET Framework based code, then you should really have look at the WCF Rest Starter Kit. There is a handy class called HttpClient that is, in my opinion, provides the best / cleanest way to consume REST services at the http level. Essentially, it gives you the ability to make http calls as easy as:
There is so much more to HttpClient than the little snippet above, including ways to easily hydrate / deserialize the response of the REST service into a .NET types. You have quite a bit of power / control over the common REST service consumption scenarios. There’s a nice little blog post over at The .NET Endpoint blog which covers HttpClient. The BEST starting point, again my opinion, for learning about HttpClient is these two Ch. 9 screencasts by Aaron Skonnard:
Once you’ve watched the screencasts and read the blog post, then you will probably want to learn a bit more about the WCF REST Starter Kit. Here’s a great overview of the kit (also by Aaron Skonnard):
https://msdn.microsoft.com/en-us/library/ee391967.aspx
-Marc
Comments
- Anonymous
February 09, 2010
I started a project called RestSharp that makes calling RESTful APIs even easier than the WCF Toolkit. You can find it at http://restsharp.org. It solves a couple problems I ran into with the WCF Toolkit (most notably complex authentication requirements) and automatically handles deserialization and almost completely abstracts away the underlying HTTP calls.