An application I use has a REST API. In C#, is there an example of writing a wrapper for this to invoke the API's functions?
Thanks
Writing your own wrapper for REST usage is not terribly difficult. Any client would be making use of the HttpWebRequest and HttpWebResponse objects to execute GET requests and retrieve the results. (There are other objects in the .Net Framework that can be used, but I've found these to be the most useful.)
This is actually the simple part. How you interpret the results (read as a string, parse the xml response, deserialize to strongly-typed objects, etc.) are more involved in the decision process. My advice to this end: keep it as simple as you can, but make your wrapper self-contained. Don't require your calling logic to have to know anything about sending the request or interpreting the response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With