MakeEasy.RestClient 0.11.4

dotnet add package MakeEasy.RestClient --version 0.11.4
                    
NuGet\Install-Package MakeEasy.RestClient -Version 0.11.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MakeEasy.RestClient" Version="0.11.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MakeEasy.RestClient" Version="0.11.4" />
                    
Directory.Packages.props
<PackageReference Include="MakeEasy.RestClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MakeEasy.RestClient --version 0.11.4
                    
#r "nuget: MakeEasy.RestClient, 0.11.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MakeEasy.RestClient@0.11.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MakeEasy.RestClient&version=0.11.4
                    
Install as a Cake Addin
#tool nuget:?package=MakeEasy.RestClient&version=0.11.4
                    
Install as a Cake Tool

MakeEasy.RestClient

Project Description

This is an easy-to-use RESTful or Rest Web API client library. It's a wrapper of HttpClient. The goal of this library is to be very MakeEasy to use. Any suggestions or improvements to the project are welcome.

How to use

Post

  • Post json object
using var client = new RestClient("https://api.example.com");
var response = await client.PostAsync("/Person/Insert", new { name = "John", age = 30 });

In none-generic version, it will throw an exception if there's an error in network/framework. You need to check the response status code and content by yourself. For example:

response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
  • if you want to pass query parameters, you can use Options to generate the url.
var reponse = await client.PostAsync(
	"/Person/Insert",
	new { name = "John", age = 30 },
	new SendOptions {
		QueryParams = new {some properties})
	}
	);
  • Post MultiPart
var multipart = new MultipartFormDataContent();
multipart.Add(new StringContent("value1"), "key1");
multipart.Add(new StringContent("value2"), "key2");
var fs = new FileStream("path/to/file.txt", FileMode.Open);
multipart.Add(new StreamContent(fs), "file", "file.txt");
var reponse = await client.PostMultipartAsync("/Person/Insert", multiPart);
  • Post pure string as body
var body = """
	{
		"name"="John",
		"age"=30
	}
""";
var reponse = await client.PostStringAsync("/Person/Insert", body, RestContentTypes.Json);
  • Generic Post
var count = await client.PostAsync<int>("/Person/Insert", new { name = "John", age = 30 });
Console.WriteLine($"inserted count: {count}");

In generic version, it will throw an exception if there's an error in network/framework or status code. You don't need to check the response status code generally.

Get

var person = await client.GetAsync<Person>("/Person/FindByName", new { name = "John" });

Other Methods

Other methods like Put/Delete/Patch/Options/Head are similar to Post and Get.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.11.4 130 9/27/2025
0.11.3 246 4/15/2025
0.11.2 137 4/12/2025
0.11.1 146 4/12/2025

Add HttpMessageHandler at RestClient creator