VMD.RESTApiResponseWrapper.Net 1.0.0

A REST global exception handler and response wrapper for Web API written in Full .NET Framework

There is a newer version of this package available.
See the version list below for details.
Install-Package VMD.RESTApiResponseWrapper.Net -Version 1.0.0
dotnet add package VMD.RESTApiResponseWrapper.Net --version 1.0.0
<PackageReference Include="VMD.RESTApiResponseWrapper.Net" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VMD.RESTApiResponseWrapper.Net --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

STEPS to use the RESTApiResponseWrapper.Net

  1. Declare the following namespace within WebApiConfig.cs

using VMD.RESTApiResponseWrapper.Net;
using VMD.RESTApiResponseWrapper.Net.Filters;

  1. Register the following within WebApiConfig.cs

config.Filters.Add(new ApiExceptionFilter());
config.MessageHandlers.Add(new WrappingHandler());

  1. Done.

To use the Custom API Exception, you could do:

throw new ApiException("Your Message",401, ModelStateExtension.AllErrors(ModelState));


The ApiException has the following parameters:

ApiException(string message,
int statusCode = 500,
IEnumerable<ValidationError> errors = null,
string errorCode = "",
string refLink = "")


For ASP.NET Core Folks

You can try download the .NET Core version of this wrapper at https://www.nuget.org/packages/VMD.RESTApiResponseWrapper.Core/


STEPS to use the RESTApiResponseWrapper.Net

  1. Declare the following namespace within WebApiConfig.cs

using VMD.RESTApiResponseWrapper.Net;
using VMD.RESTApiResponseWrapper.Net.Filters;

  1. Register the following within WebApiConfig.cs

config.Filters.Add(new ApiExceptionFilter());
config.MessageHandlers.Add(new WrappingHandler());

  1. Done.

To use the Custom API Exception, you could do:

throw new ApiException("Your Message",401, ModelStateExtension.AllErrors(ModelState));


The ApiException has the following parameters:

ApiException(string message,
int statusCode = 500,
IEnumerable<ValidationError> errors = null,
string errorCode = "",
string refLink = "")


For ASP.NET Core Folks

You can try download the .NET Core version of this wrapper at https://www.nuget.org/packages/VMD.RESTApiResponseWrapper.Core/

Release Notes

Initial release

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.3 389 5/1/2018
1.0.2 347 4/28/2018
1.0.1 273 4/26/2018
1.0.0 220 4/18/2018