Install

Install-Package RestSharp

(or download)

Documentation

Get Started - All

Contributions welcome!

Discuss

RestSharp Google Group

Help and feature requests

Stay Updated

Follow @RestSharp

Subscribe to the RSS feed

Silverlight and Windows Phone 7 Now Supported

I’ve added support for Silverlight 4 and Windows Phone 7 to RestSharp. Please try it out and report back any errors or other feedback you have. You can download the latest revision here.

Here’s an example:

var client = new RestClient("http://example.com");
var request = new RestRequest("resource", Method.POST);

client.ExecuteAsync<Resource>(request, (response) => {
    var resource = response.Data;
});

As a side note, the core library is also now set to use the Client Profile by default. The Async methods from Silverlight/WP7 are also available in the core library as well.

Posted July 15th, 2:47 PM
Read more posts about Announcements, Samples, Silverlight, Windows Phone 7.

10 Comments - Join The Discussion
Link

  • Melika

    Does this allow for maintaining cookies or no?

  • http://john-sheehan.com/blog John Sheehan

    RestResponse.Cookies has all of the cookies returned from the server. Someone added a simple way to send them back in subsequent responses, but I need to track that down.

  • http://twitter.com/bkaid Brandon Kaid

    A simple way to re-send cookies would be great – I will log on github.

  • Ben

    I tried out the sample code and I get this issue:

    ErrorMessage = “The 'Content-Length' header cannot be modified directly.rnParameter name: name”

    I opened the windows phone 7 project, built the solution and adding the rest dll to my project. Am i missing something?

  • Anonymous

    one gotcha with silverlight/wp7…responses to httpwebrequests are automatically cached. there’s a relatively easy workaround in restsharp. you can “individualize” the calls by adding a nocache header with a guid value. it’d look something like:

    var request = new RestRequest(“resource”, Method.POST);
    request.AddParameter(“nocache”, Guid.NewGuid());

  • http://john-sheehan.com/blog John Sheehan

    do you have any links to docs that explain this caching?

  • VVVVV

    hey can u be bit more clear please. I’m not able to understand how to do. I have added the refernences to the project and written the above code in the button click. but, it is throwing error saying response cannot be found.

  • http://twitter.com/TheSaintr Cristovao Morgado

    Can you update for 102 ?

  • Aj

    Is there any support to used Visual Studio Async?

  • http://john-sheehan.com/blog John Sheehan

    not yet. once .net 4.5 is out officially, maybe then.