REST API SDK

by Janglin Software

Version 2.0.3

Helper method library with convenient methods to assist with creating more specific web API SDKs.

Samples

Append Extension Method.

Allows creation of a URL starting with a base URL (i.e. domain) and allowing routes to be appended with automatic insertion of slashes and whitespace trimming.

// Append Extension Method:
// To get: http://service.com/testing/
var result = "http://service.com".Append("testing");

// To get: http://service.com/testing/testing/
var result = "http://service.com".Append("testing", "testing");
// or:
var stringarray = new string[] { "testing", "testing1" }
"http://service.com".Append(stringarray);

REST Exception.

Allows convenient transformation of the WebException.

try
{
var response = webrequest.GetResponse();
// Do work here...
}
catch (WebException ex) { throw new RestException(ex); }

// =====================================================

try
{
// API SDK call here here...
}
catch (RestException ex) {
var HttpStatusCode code = ex.StatusCode;
var string description = ex.StatusDescription;
var string details = ex.ErrorDetails; // Full response body text.
var string message = ex.WebExceptionMessage;// Generic message.
var WebResponse response = ex.Response;
}

Release Notes

2.0.3 - Bug fixes.

2.0.2 - Bug fixes.

2.0.1 - Bug fixes.

2.0.0 - Narrowed focus to REST exception and extension methods.

1.1.0 - Improved NuGet package.

1.0.0 - Initial release.


Resources

View the license agreement License

Get the NuGet package at Rest API SDK