RestWrapper 1.0.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package RestWrapper --version 1.0.8
NuGet\Install-Package RestWrapper -Version 1.0.8
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="RestWrapper" Version="1.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RestWrapper --version 1.0.8
#r "nuget: RestWrapper, 1.0.8"
#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.
// Install RestWrapper as a Cake Addin
#addin nuget:?package=RestWrapper&version=1.0.8

// Install RestWrapper as a Cake Tool
#tool nuget:?package=RestWrapper&version=1.0.8

RestWrapper

A simple C# class library to help simplify RESTful HTTP requests and responses.

Test App

A test project is included which will help you exercise the class library.

Available APIs

Two static methods exist: SendRequest and SendRequestSafe. The differences are as follows:

  • SendRequest will throw any exception encountered to the caller
  • SendRequestSafe will take any WebException and create a RestResponse object from it. Other exceptions are thrown to the caller

Example

using RestWrapper;

//
// Simple GET with No Credentials
//
RestResponse resp = RestRequest.SendRequest(
	"http://www.github.com/",	// URL
	null, 						// content-type
	"GET",						// verb/method
	null, null, false, 			// user, password, encode
	null, 						// headers
	null);						// byte array data

//
// Enumerate response
//
Console.WriteLine(
	"Received " + resp.StatusCode + " (" + resp.ContentLength + " bytes) " +
	"with data: " + Encoding.UTF8.GetString(resp.Data));

//
// POST with Headers and Credentials
//
Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("x-custom-header", "my-custom-value");
byte[] data = Encoding.UTF8.GetBytes("some-field=some-value&hello=world");

RestResponse resp = RestRequest.SendRequest(
	"https://my.server.com/form",			// URL
	"application/x-www-form-urlencoded",	// content-type
	"POST",									// verb/method
	"my-username", "my-password", true, 	// user, password, encode
	headers,								// headers
	data);									// byte array data

//
// Enumerate response
//
Console.WriteLine(resp.ToString());		// Easy peasy
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (14)

Showing the top 5 NuGet packages that depend on RestWrapper:

Package Downloads
KvpbaseSDK

C# SDK for Kvpbase object storage platform

Komodo.Sdk

Client SDK in C# for Komodo. Please either install Komodo.Daemon to integrate search within your application, or Komodo.Server to run a standalone server if you wish to use this client SDK. Komodo is an information search, metadata, storage, and retrieval platform.

GoogleMapsClient

I needed a simple way to parse addresses and resolve coordinates to an address. Plug in a Google Maps API key and you're all set.

ArangoDBLite

ArangoDBLite is a lightweight SDK for the RESTful API provided by the ArangoDB graph database platform.

SendWithMailgun

Simple class library to send email and validate email addresses using Mailgun.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on RestWrapper:

Repository Stars
dotnet/WatsonWebserver
Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
Version Downloads Last updated
3.0.19 53 3/27/2024
3.0.18 561 1/16/2024
3.0.17 646 11/25/2023
3.0.16 370 11/10/2023
3.0.15 355 11/10/2023
3.0.14 669 10/21/2023
3.0.12 404 10/20/2023
3.0.11 389 10/20/2023
3.0.10 639 10/6/2023
3.0.9 362 10/6/2023
3.0.8 1,179 9/4/2023
3.0.7 474 9/4/2023
3.0.6 516 9/1/2023
3.0.5 515 8/31/2023
3.0.4 466 8/31/2023
3.0.3 1,214 8/24/2023
3.0.2 5,975 7/23/2023
3.0.1 1,194 7/12/2023
3.0.0 626 7/12/2023
2.3.2 2,850 3/27/2023
2.3.1.1 20,600 9/4/2022
2.3.1 2,534 8/15/2022
2.3.0 865 8/15/2022
2.2.1.15 1,597 8/11/2022
2.2.1.14 12,443 11/19/2021
2.2.1.13 19,615 11/12/2021
2.2.1.12 5,049 8/14/2021
2.2.1.11 5,558 5/10/2021
2.2.1.10 4,264 2/15/2021
2.2.1.9 830 2/15/2021
2.2.1.8 1,214 2/11/2021
2.2.1.7 908 2/11/2021
2.2.1.6 2,124 1/21/2021
2.2.1.5 2,517 12/28/2020
2.2.1.4 10,436 11/16/2020
2.2.1.3 3,937 11/15/2020
2.2.1.2 1,256 10/24/2020
2.2.1.1 945 10/24/2020
2.2.1 1,070 10/23/2020
2.2.0 1,024 10/23/2020
2.1.5 1,286 10/15/2020
2.1.4.2 12,876 9/10/2020
2.1.4.1 117,632 1/17/2020
2.1.4 13,931 12/5/2019
2.1.3 11,694 10/28/2019
2.1.2 3,495 9/22/2019
2.0.4 4,500 6/13/2019
2.0.3 1,708 6/5/2019
2.0.2 1,252 4/30/2019
1.0.9 6,543 3/10/2019
1.0.8 4,134 8/11/2017
1.0.7 1,535 6/23/2017
1.0.6 1,582 5/14/2017
1.0.5 1,612 10/11/2016
1.0.4 1,513 10/7/2016

Variable casing, conversion methods, suppor for OPTIONS