Home - nripendra/Resty.Net GitHub Wiki

Resty.Net

A simple bare to metal REST client for .net framework. Although it is written in c#, it should be fairly easy to use the assembly in any other .net aware languages. It serves as a very thin layer above HttpWebRequest object exposes most of its properties. Also provides an option to directly access the underlying HttpWebRequest and HttpWebResponse objects if necessary, while giving you many high level functionalists that a programmer comes to expect from a generic rest client.

In comparison to most of available REST clients today, Resty.Net stands as a middle level REST client for c# and other dotnet(.net) languages. Gives you a fair amount of low level control very much similar to the .net's native HttpWebRequest class, but also handles many high level tasks such as easy async operations, serialization of request body and deserialization of the server response etc.

Example

RestRequest request = new RestRequest(HttpMethod.GET, new RestUri("http://example.com/api", "/Person/{id}")
                                                              .SetParameter("id", "1"));

request.AddHeader(new { header = "value" });
request.AddHeader("header2", "value");

using (RestResponse response = request.GetResponse())
{
  var contentStream = response.Body.ReadAsStream();
  var contentByteArray = response.Body.ReadAsByteArray();
  string contentString = response.Body.ReadAsString();
}

//strongly typed response
RestRequest request2 = new RestRequest(HttpMethod.GET, new RestUri("http://example.com/api", "/Person/{id}")
                                                               .SetParameter("id", "2"));

request.AddHeader(new { header = "value" });
request.AddHeader("header2", "value");

using (RestResponse<Person> response = request.GetResponse<Person>())
{
  var person = response.Data;
  var email = person.Email;
}

You will be able to obtain more information on Resty.Net in this wiki as I update the wiki in future, or you can also follow my blog at: http://nripendra-newa.blogspot.com/. Here is the blog post introducing Resty.Net.

More documentations and tutorials are on their way. Stay tuned...

More information:

How to get Resty.Net?

⚠️ **GitHub.com Fallback** ⚠️