About the Cloud API

Our cloud based application programming interface is built on the SOAP protocol. SOAP (Simple Object Access Protocol) is an XML based data format used to communicate between two system across the internet in a secure and reliable way. All data communication between your systems and our Cloud API is encrypted via a HTTPS secure connection.

As a recognised industry standard, SOAP is directly compatible with a variety of different platforms.

How to get it

You will need to contact us to arrange an API account. We provide you with all the details you need to start building your own Mailsort/Mailmark enabled application. You will also receive a sample application written in C# with comprehensive code samples showcasing all the features in the API.

Initially we can issue a fully functioning API Test account albeit with limitations on record numbers. This will allow you to complete the programming phase prior to the full account coming into force.

Getting Started

Once you have your API account you will need to add a "Connected Service" reference to your project before you can use the API.

Below you can see a flavour of some of the functions as written in C#.

Prepare the name space

Enter the "using" statement as below to register the API namespace to your code:

using YourAppNameSpace.MailsortOnline;

Declare an api client variable and a session token string variable with codewide scope:

ApiSoapClient client = new ApiSoapClient();
string sessionToken = "";

Login to the API

You need to login to your API account before you can run any of the remaining functions in the API.

ApiResponse response = client.Login("username", "password")
if (response.Success)
{
    sessionToken = response.SessionToken;
}

On sucecessful login the response object will return a sessionToken. This is a guid text string which must be passed to every subsequent function call to the API.

The response object also returns various other details such as your account expiry date and which services are enabled for your account.

Create a mailsort or mailmark job

Create a new job to be processed by the API. Declare the apiJob object and set it's properties to the appropriate processing parameters. (eg. product code, item weight, format etc.)

ApiResponse response = client.JobCreate(sessionToken, apiJob)
if (response.Success)
{
    long jobID = response.ID;
    ApiResponse response = client.JobUploadAddressFile(sessionToken, jobID, data); // data = byte array
    if response.Success)
    {
        //Upload complete. Set a timer to check the processing status with a minimum of 5 second intervals
    }
}

Upon "upload complete", set a timer to check the processing status as follows:

ApiResponse response = client.JobCreate_Status(sessionToken, jobID)
if (response.Success)
{
    if (response.StatusCode == 100)
    {
        //Processing complete. Proceed to download reports and sorted data
    }
    else
    {
        //Processing in progress. Wait at least 5 seconds before trying again
    }
}

Stop the timer prior to calling the status function and restart afterwards if response.StatusCode < 100 (%):

Mailmark barcoding and eManifest functions

The functions for barcoding and eManifest handling follow a similar pattern as above. I.e. Initiate the process, check success and perform regular status checks from the processing service.

Listed below are a selection of these functions:

Barcoding functions:

ApiResponse response = client.MailmarkBarcodesGenerate(sessionToken, jobMailmark, jobID);
ApiResponse response = client.MailmarkBarcodesGenerate_Status(sessionToken, jobID);

(jobMailmark = ApiJobMailmark object)

eManifest functions:

ApiResponse response = client.ManifestCreate(sessionToken, scid, handOverDate);
ApiResponse response = client.ManifestAllocateJob(sessionToken, jobID, scid, manifestID);

ApiResponse response = client.ManifestUploadJob(sessionToken, jobID, scid, manifestID, spoilsList);
ApiResponse response = client.ManifestUploadJob_Status(sessionToken, jobID);

ApiResponse response = client.ManifestCancelJob(sessionToken, jobID, scid, manifestID);
ApiResponse response = client.ManifestUnAllocateJob(sessionToken, jobID, scid, manifestID);

ApiResponse response = client.ManifestConfirm(sessionToken, scid, manifestID);