Git Product home page Git Product logo

restclient.net's Introduction

diagram

.NET REST Client Framework for all platforms

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.

Documentation Here

Announcement

Version 3.2.0 has been released!

It now works on Blazor Wasm. Check out the sample

It features a default JSON Serializer

Follow me on Twitter for updates.

A series of Blog posts will introduce the new functionality in the coming weeks. 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.

See documentation for more examples.

NuGet: Install-Package RestClient.NET

Please read this article about Serialization and Deserialization.

With Newtonsoft serialization

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);

JSON

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");

Donate

Coin Address
Bitcoin 33LrG1p81kdzNUHoCnsYGj6EHRprTKWu3U
Ethereum 0x7ba0ea9975ac0efb5319886a287dcf5eecd3038e

Please log any issues or feedback in the issues section. For pull requests, please see the contribution guide.

restclient.net's People

Contributors

melbournedeveloper avatar www avatar mackiovello avatar silic0ns0ldier avatar acecoderlaura avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.