MelbourneDeveloper / Restclient.net
Programming Languages
Projects that are alternatives of or similar to Restclient.net
.NET REST Client Framework for all platforms
Follow Me on Twitter for Updates
The best .NET REST Client with task-based async, strong types and dependency injection on all platforms. Consume your ASP .NET Core Web APIs or consume RESTful APIs over the internet in C# or Visual Basic.
Announcement
Version 4.0.0 has been released!
Check out the features and fixes. There are some breaking changes. IHttpClientFactory
and IClientFactory
have been converted to delegates to save on boilerplate code.
Check out blog posts here https://christianfindlay.com/
Why You Should Use It
- It's fast! Initial tests show that it is faster than RestSharp and is one of the faster .NET Rest Clients available.
- 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.
Quick Start & Samples
See documentation for more examples.
NuGet: Install-Package RestClient.NET
Please read this article about Serialization and Deserialization.
Get
var client = new Client(new NewtonsoftSerializationAdapter(), new Uri("https://restcountries.eu/rest/v2/"));
var response = await client.GetAsync<List<RestCountry>>();
With default serialization on .NET Core
var client = new Client(new Uri("https://restcountries.eu/rest/v2/"));
var response = await client.GetAsync<List<RestCountry>>();
Post / Put / Patch
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");
Delete
var client = new Client(new NewtonsoftSerializationAdapter(), new Uri("https://jsonplaceholder.typicode.com"));
await client.DeleteAsync("posts/1");
Donate
Coin | Address |
---|---|
Bitcoin | 33LrG1p81kdzNUHoCnsYGj6EHRprTKWu3U |
Ethereum | 0x7ba0ea9975ac0efb5319886a287dcf5eecd3038e |
Contribution
Please log any issues or feedback in the issues section. For pull requests, please see the contribution guide.