This blog is about the new KooBoo Integrated Couriers library. This library is an on going project to bring easy courier integration with South African based courier companies to .Net developers.
The library is used in our award winning ecommerce platform should you not want to write your own system. You can easily get your own store up and running with courier integration using KooBoo Evolution without the need for a whole development and design team.
The library can be found on NuGet and you can add it to your project usingPM> Install-Package KooBoo.IntegratedCouriers
https://www.nuget.org/packages/KooBoo.IntegratedCouriers/
Currently the library only supports MDS Collivery as they have a fantastic well planned integration API.
In order to use MDS Collivery you will have to sign up for an account to obtain the access credentials needed for the API.
The KooBoo Integrated Couriers library currently supports all features specified in the MDS integration guide at the time of writing http://www.collivery.co.za/wsdocs/
Using the Library
In order to get started, you will need to add a reference to the library
using KooBoo.IntegratedCouriers.MDSCollivery;
After you added your reference you can create a new instance of the Collivery class. This class is your entry point and houses all the methods needed.Collivery collivery = new Collivery() {
auth = new AuthenticateRequest() {
email = username,
password = password,
info = new AuthenticateRequestInfo() {
host = "Host Name", lang = ".Net,ASP.NET MVC,MS SQL,C#",
name = CompanyName", },
old_token = token } };
Now that you have a collivery instance can you call the authenticate method in order to validate your credentials and obtain your access token for subsequent requestsAuthenticateResponse authResp = await collivery.authenticate();
After you have authenticated, save your token and reuse it with other requests. Having too many tokens creates a security risk.
Here is an example of how to get a list of towns that you can bind to a dropdown listGetTownsResponse townList = await collivery.get_towns(new GetTownsRequest() {
country = countryCode,
province = mdsProvCode,
token = collivery.auth.old_token
});
TownList = (from t in townList.towns select new SelectListItem {
Text = t.town_name,
Value = t.town_id.ToString()
}).ToList();
The library is designed to easily create a Request, call the desired method and retrieve a response. The same principal can be applied to all other methods. The library also supports .Net async – await to minimize the load on the server should there be any long running requests.
I hope that in the future this library can become the most feature rich library with a wide variety of South African courier companies to choose from.