Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a RestSharp implementation that works with Portable Class Libraries?

When I try to add RestSharp to a portable class library project using nuget, I get the following:

Could not install package 'RestSharp 104.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile104', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I assume then it is not supported? If that be the case anyone have any suggestions on how to get this to work?

like image 440
Eric Avatar asked Nov 24 '12 21:11

Eric


3 Answers

Another interesting option is Flurl

Flurl is a modern, fluent, asynchronous, testable, portable, buzzword-laden URL builder and HTTP client library.

Code snippet:

var result = await "https://api.mysite.com"
    .AppendPathSegment("person")
    .SetQueryParams(new { a = 1, b = 2 })
    .WithOAuthBearerToken("my_oauth_token")
    .PostJsonAsync(new { first_name = "Frank", last_name = "Underwood" })
    .ReceiveJson<T>();
like image 183
Nicola Iarocci Avatar answered Oct 13 '22 20:10

Nicola Iarocci


You have a portable RestSharp working at:

https://github.com/Geodan/geoserver-csharp/tree/master/RestSharp

It seems it's working well... It uses Json.net portable version too

like image 30
Rui Marinho Avatar answered Oct 13 '22 20:10

Rui Marinho


You may try RestSharp.Portable. This is a library which offers an API very similar to RestSharp.

like image 37
Mark Avatar answered Oct 13 '22 20:10

Mark