Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: bf6ad2b841
Fetching contributors…

Cannot retrieve contributors at this time

176 lines (151 sloc) 6.146 kb
---
title: RestSharp - Simple REST and HTTP Client for .NET
---
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>RestSharp - Simple REST and HTTP Client for .NET</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<script src="javascripts/scale.fix.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="wrapper">
<header>
<h1>RestSharp</h1>
<p>Simple REST and HTTP API Client for .NET</p>
<p class="view"><a href="https://github.com/restsharp/RestSharp">View the Project on GitHub <small>restsharp/RestSharp</small></a></p>
<ul>
<li><a href="http://nuget.org/packages/RestSharp">Download on <strong>NuGet</strong></a></li>
<li><a href="https://github.com/restsharp/RestSharp">Fork on <strong>GitHub</strong></a></li>
<li><a href="http://groups.google.com/group/restsharp">Get <strong>help</strong></a></li>
</ul>
<p><a href="https://twitter.com/RestSharp" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @RestSharp</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
</header>
<section>
<h3>NEED HELP with RestSharp?</h3>
<p><strong>Post your question to the <a href="http://groups.google.com/group/restsharp">Google Group</a> or <a href="http://stackoverflow.com/questions/tagged/restsharp">StackOverflow</a></strong>. If you think you've found a bug, post it to the group before creating an issue on GitHub.</p>
<p>Pull requests gladly accepted, but if it's a big change you should discuss it with the group first to make sure it fits into the goals and plans of the project.</p>
<h4><a href="https://github.com/restsharp/RestSharp/wiki/Submission-Guidelines">Contribution Guidelines</a></h4>
<h4><a href="https://github.com/restsharp/RestSharp/wiki">Documentation</a></h4>
<h4><a href="https://github.com/restsharp/RestSharp/wiki/Acknowledgements">Contributors and Acknowledgements</a></h4>
<h3>Important change in version 103.0.0</h3>
<p>Version 103 removed JSON.NET as a dependency. <a href="https://github.com/restsharp/RestSharp/blob/master/readme.txt">Please read this</a>
and <a href="https://groups.google.com/d/msg/restsharp/yjGCtOnEYHk/XbKZi0yjN8cJ">this</a>.
</p>
<h3>Examples</h3>
{% highlight csharp %}
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
// easily add HTTP Headers
request.AddHeader("header", "value");
// add files to upload (works with compatible verbs)
request.AddFile(path);
// execute the request
RestResponse 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();
RestResponse<Person> response2 = client.Execute<Person>(request);
var name = response2.Data.Name;
// 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();
{% endhighlight %}
<h3>The Latest</h3>
<script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script>
<div style="float:left;">
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 10,
interval: 30000,
width: 500,
height: 500,
theme: {
shell: {
background: '#eeeeee',
color: '#555555'
},
tweets: {
background: '#ffffff',
color: '#000000',
links: '#3399cc'
}
},
features: {
scrollbar: false,
loop: false,
live: true,
behavior: 'all'
}
}).render().setUser('RestSharp').start();
</script>
</div>
<div style="float:left;">
<script>
new TWTR.Widget({
version: 2,
type: 'search',
search: 'restsharp',
interval: 30000,
title: 'RestSharp',
subject: 'Across the Twitters',
width: 500,
height: 500,
theme: {
shell: {
background: '#eeeeee',
color: '#555555'
},
tweets: {
background: '#ffffff',
color: '#000000',
links: '#3399cc'
}
},
features: {
scrollbar: false,
loop: false,
live: true,
behavior: 'all'
}
}).render().start();
</script>
</div>
</section>
<footer>
<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<!--[if !IE]><script>fixScale(document);</script><!--<![endif]-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8399155-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.