I've written a few very casual wrappers around REST and less structured web interfaces, but all just for fun, with very little attention to error detection and handling, timeouts, etc.
Can somebody please give me some pointers, either on practices, or to resources, for developing a solid, professional .NET (or other platform) wrapper for a REST API?
Things that cross my mind are:
- Interpreting HTTP error codes and filtering protocol errors from API errors.
- Building URL based requests, possibly with pattern matching and token substitution.
- Matching post-backs to requests.
- How to map an OO model to the REST model. Some requests suit static methods, e.g. getting lists, and others hang in the middle between static and instance, maybe a plain provider pattern with all static methods?
NEW: I've since found this almost too basic guide to making Yahoo REST calls, but it serves as a starting point.
IMPORTANT: A very complex and seldom covered aspect is how to deal with forms authentication on the REST API. Separate login requests, cookie storage, etc.