A RestSharp fork focussed on support for Unity3D
Clone or download
Pull request Compare This branch is 11 commits ahead, 407 commits behind restsharp:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.nuget
RestSharp.Android
RestSharp.Build
RestSharp.IntegrationTests
RestSharp.MonoTouch
RestSharp.Net4.Client
RestSharp.Net4
RestSharp.Net45
RestSharp.Net451
RestSharp.Net452
RestSharp.Net46
RestSharp.Silverlight
RestSharp.Tests
RestSharp.WindowsPhone.8.0
RestSharp.WindowsPhone.8.1
RestSharp.iOS
RestSharp
Tools
.gitattributes
.gitignore
CONTRIBUTING.markdown
LICENSE.txt
README.markdown
RestSharp.sln
RestSharp.snk
appveyor.yml
build.bat
readme.txt
releasenotes.markdown
restsharp.nuspec

README.markdown

RestSharp - Simple .NET REST Client Build status

Official Site/Blog - @RestSharp

License: Apache License 2.0

Features

  • Supports .NET 3.5+, Silverlight 5, Windows Phone 8, Mono, MonoTouch, Mono for Android
  • Easy installation using NuGet for most .NET flavors
  • Supports strong naming using NuGet for most .NET flavors
  • Automatic XML and JSON deserialization
  • Supports custom serialization and deserialization via ISerializer and IDeserializer
  • Fuzzy element name matching ('product_id' in XML/JSON will match C# property named 'ProductId')
  • Automatic detection of type of content returned
  • GET, POST, PUT, HEAD, OPTIONS, DELETE supported
  • Other non-standard HTTP methods also supported
  • oAuth 1, oAuth 2, Basic, NTLM and Parameter-based Authenticators included
  • Supports custom authentication schemes via IAuthenticator
  • Multi-part form/file uploads
  • T4 Helper to generate C# classes from an XML document
var client = new RestClient("http://example.com");
// client.Authenticator = new HttpBasicAuthenticator(username, password);

var request = new RestRequest("resource/{id}", Method.POST);
request.AddParameter("name", "value"); // adds to POST or URL querystring based on Method
request.AddUrlSegment("id", "123"); // replaces matching token in request.Resource

// add parameters for all properties on an object
request.AddObject(object);

// or just whitelisted properties
request.AddObject(object, "PersonId", "Name", ...);

// easily add HTTP Headers
request.AddHeader("header", "value");

// add files to upload (works with compatible verbs)
request.AddFile("file", path);

// execute the request
IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string

// or automatically deserialize result
// return content type is sniffed but can be explicitly set via RestClient.AddHandler();
IRestResponse<Person> response2 = client.Execute<Person>(request);
var name = response2.Data.Name;

// or download and save file to disk
client.DownloadData(request).SaveAs(path);

// easy async support
client.ExecuteAsync(request, response => {
    Console.WriteLine(response.Content);
});

// async with deserialization
var asyncHandle = client.ExecuteAsync<Person>(request, response => {
    Console.WriteLine(response.Data.Name);
});

// abort the request on demand
asyncHandle.Abort();