var client = new RestClient();
client.BaseUrl = "http://example.com";
// client.Authenticator = new BasicAuthenticator(username, password);
var request = new RestRequest(); // GET by default
// request.Method = Method.GET | Method.POST | Method.PUT | Method.DELETE | Method.HEAD | Method.OPTIONS
request.Resource = "resource";
request.AddParameter("name", "value");
// 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.AddParameter("header", "value", ParameterType.HttpHeader);
// supports XML/JSON request bodies
request.RequestFormat = RequestFormat.Xml;
request.AddBody(object);
// add files (only works with compatible verbs)
request.AddFile(path);
// get raw response
RestResponse response = client.Execute(request);
// response.Content : string representation of response
// or automatically deserialize result
// return content type is sniffed but can be explicitly set via RestClient.AddHandler();
RestResponse<Person> response2 = client.Execute<Person>(request);
var name = response2.Data.Name;
// or download and save file to disk
client.DownloadData(request).SaveAs(path);
// shortcuts for parsing xml/feeds
client.ExecuteAsXDocument(request);
client.ExecuteAsXmlDocument(request);
client.ExecuteAsSyndicationFeed(request);