.net - Guidance for writing a wrapper for a REST API -


I wrote some very comfortable wrappers around the rest and less structured web interfaces, but for a lot of fun, very little Focus on error detection and handling, timeout, etc.

Is anyone solid, professional? To develop the NET (or other platform) coating, on some practices, or practices, can give me some hints.

  1. Translation of HTTP error codes and filtering protocol errors from API errors
  2. Building URL based requests, possibly with pattern mailing and token replacement.
  3. Match back-backs for requests.
  4. How to map the Oo model in the REST model. Some requests consider certain methods, e.g. The lists are getting, and others are stabilized and hung between the interstitials, maybe a plain provider pattern with all the static methods?

NEW: I have found this almost very basic since then, but it works as a starting point.

Important: A very complex and rarely overlapping aspect is to deal with form authentication on the REST API, different login requests, cookie storage, etc.

Although I have wrapped up numerous web services, an OOP-ish is the way, It seems difficult to give a good answer to the question.

A couple of Yahoo API examples can be found here:

Explain HTTP error codes and filtering protocol errors from 1 API errors.

My base http class has an http error callback that can be overridden.

2 Building URL possibly based on pattern mailing and token replacement request.

I like string containment.

How to map a model to the OST model in the REST model. Some requests consider certain methods, e.g. The lists are getting, and others are stabilized and hung between the interstitials, maybe a plain provider pattern with all the static methods?

Sometimes you need a large stable factory / provider, sometimes you have a class for each method, sometimes a class for each group of related approaches. .. There really is no proper way to go about this. I always spend some time feeling the experience of the structure of the service and then try to find a great way to summarize the repeater parts.

If there are any specific questions about your login form, cookies, etc.

Edit:

HttpWebRequest was mentioned and I I'm guessing that either need to set up and use SSL properly, or you can do with a certificate policy. / P>


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -