-
-
Notifications
You must be signed in to change notification settings - Fork 44
Quick Start & Samples
Christian Findlay edited this page Jan 2, 2020
·
8 revisions
Clone this repo and open the samples solution. There are samples for WebAssembly (in browser, UWP, Android, iOS, .NET Core, and many examples of common tasks like Polly Integration in the Unit Tests). The solution is called RestClient.Net.Samples.sln.
or
NuGet: Install-Package RestClient.NET
var client = new Client(new NewtonsoftSerializationAdapter(), new Uri("https://restcountries.eu/rest/v2/"));
var response = await client.GetAsync<List<RestCountry>>();
Protocol Buffers (Binary)
var person = new Person { FirstName = "Bob", Surname = "Smith" };
var client = new Client(new ProtobufSerializationAdapter(), new Uri("http://localhost:42908/person"));
person = await client.PostAsync<Person, Person>(person);
var client = new Client(new NewtonsoftSerializationAdapter(), new Uri("https://jsonplaceholder.typicode.com"));
client.SetJsonContentTypeHeader();
UserPost userPost = await client.PostAsync<UserPost, UserPost>(new UserPost { title = "Title" }, "/posts");
var client = new Client(new NewtonsoftSerializationAdapter(), new Uri("https://jsonplaceholder.typicode.com"));
await client.DeleteAsync("posts/1");