The best .NET REST Client with task-based async, strong types and dependency injection on all platforms.
Version 3 has been released!
Follow me on Twitter for updates.
A series of Blog posts will introduce the new functionality in the coming weeks. https://christianfindlay.com/
- Designed for Dependency Injection, Unit Testing and use with IoC Containers
- Async friendly. All operations use async, await keywords.
- Integrates with Polly resilience and transient-fault-handling
- Automatic serialization with any method (JSON, Binary, SOAP, Google Protocol Buffers)
- Installation from NuGet is easy on any platform
- Uses strong types with content body
- Supports WebAssembly, Android, iOS, Windows 10, .NET Framework 4.5+, .NET Core (.NET Standard 2.0)
- Supports GET, POST, PUT, PATCH, DELETE with ability to use less common HTTP methods
These features together make this the best C# REST client and the best alternative to RestSharp. Consuming REST APIs is simple and encourages best practice.
See documentation for more examples.
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");
Coin | Address |
---|---|
Bitcoin | 33LrG1p81kdzNUHoCnsYGj6EHRprTKWu3U |
Ethereum | 0x7ba0ea9975ac0efb5319886a287dcf5eecd3038e |
Please log any issues or feedback in the issues section. For pull requests, please see the contribution guide.