Reputation: 47733
I'm trying to figure out if the best way to consume and use a 3rd party API that is REST is to use WCF
or just use System.Runtime.Serialization.Json
Namespace or the WebClient
object in .NET and create my own methods to send and receive json objects to and from the REST service I'm consuming.
So far I've only seen consuming REST json of an existing WCF service. Can you use WCF to consume and work with (request/response) any json based REST service outside of .NET?
Upvotes: 1
Views: 1403
Reputation: 6002
Yes, you can consume Flickr services using WCF as described here. You just need to change the ResponseFormat in the WebGet (and WebInvoke) attributes to be Json.
However, my experience is that it is rather painful when you deal with stuff like error handling or complex authentication schemes. I found it simpler to manually write the client using the WebRequest class.
Upvotes: 1