DalSoft.RestClient 4.4.0

C# Rest Client with a fluent API for all platforms.
     
     Extend HttpClient using Pipeline features
     
     Trusted by enterprises
     
     Easy Unit Testing

     Everything you need to know: https://restclient.dalsoft.io/

Install-Package DalSoft.RestClient -Version 4.4.0
dotnet add package DalSoft.RestClient --version 4.4.0
<PackageReference Include="DalSoft.RestClient" Version="4.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DalSoft.RestClient --version 4.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DalSoft.RestClient, 4.4.0"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

DalSoft C# RestClient

Nuget
Help and chat on Gitter
StackOverflow
Docs

For everything you need to know, please head over to https://restclient.dalsoft.io

👉 New Static Typing and Resource Expressions in 4.0

alt text

Just some of the things you can do with DalSoft.RestClient

Supported Platforms

RestClient targets .NET Standard 2.0 therefore supports Windows, Linux, Mac and Xamarin (iOS, Android and UWP).

If you need to target .NET Standard 1.4 use version 3.2.2.

Getting Started

Install via .NET CLI

> dotnet add package DalSoft.RestClient

Install via NuGet

PM> Install-Package DalSoft.RestClient

Example calling a REST API

You start by new'ing up the RestClient and passing in the base uri for your RESTful API.

For example if your wanted to perform a GET on https://jsonplaceholder.typicode.com/users/1 you would do the following:

Static Typed Rest Client

For the Static typed Rest Client just pass a string representing the resource you want access to the Resource method, and then call the HTTP method you want to use.

var client = new RestClient("https://jsonplaceholder.typicode.com");

User user = await client.Resource("users/1").Get();
   
Console.WriteLine(user.Name);

Dynamicaly Typed Rest Client

For the Dynamicaly typed Rest Client chain members that would make up the resource you want to access - ending with the HTTP method you want to use.

dynamic client = new RestClient("https://jsonplaceholder.typicode.com");

var user = await client.Users(1).Get();
   
Console.WriteLine(user.name);

Note all HTTP methods are async

Recent Releases

About

RestClient is a very lightweight wrapper around System.Net.HttpClient that uses the dynamic features of .NET 4 to provide a fluent way of accessing RESTFul API's, making it trivial to create REST requests using a lot less code.

Originally created to remove the boilerplate code involved in making REST requests using code that is testable. I know there are a couple of REST clients out there but I wanted the syntax to look a particular way with minimal fuss.

RestClient is biased towards posting and returning JSON - if you don't provide Accept and Content-Type headers then they are set to application/json by default See Working with non JSON content.

Standing on the Shoulders of Giants

DalSoft.RestClient is built using the following great open source projects:

DalSoft.RestClient is inspired by and gives credit to:

DalSoft C# RestClient

Nuget
Help and chat on Gitter
StackOverflow
Docs

For everything you need to know, please head over to https://restclient.dalsoft.io

👉 New Static Typing and Resource Expressions in 4.0

alt text

Just some of the things you can do with DalSoft.RestClient

Supported Platforms

RestClient targets .NET Standard 2.0 therefore supports Windows, Linux, Mac and Xamarin (iOS, Android and UWP).

If you need to target .NET Standard 1.4 use version 3.2.2.

Getting Started

Install via .NET CLI

> dotnet add package DalSoft.RestClient

Install via NuGet

PM> Install-Package DalSoft.RestClient

Example calling a REST API

You start by new'ing up the RestClient and passing in the base uri for your RESTful API.

For example if your wanted to perform a GET on https://jsonplaceholder.typicode.com/users/1 you would do the following:

Static Typed Rest Client

For the Static typed Rest Client just pass a string representing the resource you want access to the Resource method, and then call the HTTP method you want to use.

var client = new RestClient("https://jsonplaceholder.typicode.com");

User user = await client.Resource("users/1").Get();
   
Console.WriteLine(user.Name);

Dynamicaly Typed Rest Client

For the Dynamicaly typed Rest Client chain members that would make up the resource you want to access - ending with the HTTP method you want to use.

dynamic client = new RestClient("https://jsonplaceholder.typicode.com");

var user = await client.Users(1).Get();
   
Console.WriteLine(user.name);

Note all HTTP methods are async

Recent Releases

About

RestClient is a very lightweight wrapper around System.Net.HttpClient that uses the dynamic features of .NET 4 to provide a fluent way of accessing RESTFul API's, making it trivial to create REST requests using a lot less code.

Originally created to remove the boilerplate code involved in making REST requests using code that is testable. I know there are a couple of REST clients out there but I wanted the syntax to look a particular way with minimal fuss.

RestClient is biased towards posting and returning JSON - if you don't provide Accept and Content-Type headers then they are set to application/json by default See Working with non JSON content.

Standing on the Shoulders of Giants

DalSoft.RestClient is built using the following great open source projects:

DalSoft.RestClient is inspired by and gives credit to:

Release Notes

Formal Act API method added
     await _restClient.Resource("users/1").Get()
     .Act<User>(response =>
     {
        Assert.AreEqual("Leanne Graham", response.name);
        Assert.AreEqual("Bret", response.username);
     });

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DalSoft.RestClient:

Package Downloads
RoomerSDK
SDK for Roomer API
DalSoft.RestClient.Testing
Use DalSoft.RestClient with ASP.NET Core In-Memory Test Server for integration tests.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on DalSoft.RestClient:

Repository Stars
MelbourneDeveloper/RestClient.Net
.NET REST Client Framework for all platforms

Version History

Version Downloads Last updated
4.4.0 1,093 12/18/2020
4.3.0 404 11/25/2020
4.2.1 3,520 9/24/2020
4.2.0 9,345 10/26/2019
4.1.0 5,867 8/24/2019
4.0.0 776 8/4/2019
3.3.2 10,440 12/3/2018
3.3.1 1,782 10/29/2018
3.3.0 3,454 7/11/2018
3.2.3 949 4/25/2018
3.2.2 37,905 5/4/2017
3.1.1 675 4/23/2017
3.1.0 625 4/20/2017
3.0.3 1,397 2/27/2017
3.0.2 730 2/23/2017
2.0.4 3,023 12/2/2016
2.0.2 863 11/2/2016
2.0.1 606 10/28/2016
2.0.0 794 10/27/2016
1.0.10 2,144 6/14/2016
1.0.9 2,100 8/28/2015
1.0.8 644 8/28/2015
1.0.7.27011 704 8/3/2015
1.0.7.15372 642 8/28/2015
1.0.6 852 5/11/2015
1.0.5.2623 638 4/25/2015
1.0.4.41175 715 2/1/2015
1.0.4.41083 604 4/24/2015
1.0.3.29240 666 1/21/2015
1.0.2.31019 679 1/20/2015
1.0.1 669 1/15/2015
1.0.0 697 1/14/2015