• Home
  • Contacts
  • On The Go
  • Track
  • Settings
  • Search

Status (Tracking) API

The Status API allows users to get the current status of freight references, providing two methods with different levels of detail.

Provided in the response is chained references (currently offered for Logistics and Transport), proof of delivery links and signed by detail.

All methods utilise a RESTful approach; supporting both XML and JSON formats. 

Available Methods

Security

An API key is required for all requests. API keys will only be valid in the environment they are created for.

API Terms of Use

By registering for and/or accessing any API found on this developer website, you understand and have agreed to our API Terms of Use.

Click here to read our API Terms of Use.

Model Drop in DLL

Mainfreight provides a .NET compatible library with model for all the entities that can be used to make it easier for developers to communicate with the Mainfreight APIs.

Service consumer Drop in DLL

Mainfreight also provides a .NET compatible library which provides wrapping methods to easily consume the Mainfreight Status API.

You can find a copy of these drop in dlls here.

Please note, Mainfreight.Api.Status.Client.dll requires Mainfreight.Api.Status.Model.dll and Mainfreight.Api.Common.Client.dll.

Drop in DLL usage example

References Example

To list all available anonymous notifications for a particular document you have to post a json similar to this (notice that no session secret is used):

  • C#
< > grab code
try
{
	StatusClient client = new StatusClient("YOUR_API_KEY");
	References references = client.References(ServiceTypes.TransportNz, "ABC900000999", ReferenceTypes.ConsignmentNumber);

	if (references.Count > 0)
	{
		Console.WriteLine(string.Format("Code = {0}\r\nOurReference = {1} \r\nYourReference: \r\n{2}\r\nTrackingUrl: \r\n{3}",
			references[0].OurReference, references[0].YourReference, references[0].TrackingUrl));
	}
	else
	{
		Console.WriteLine(string.Format("Code = {0}\r\nThere are no results for that reference."));
	}
}
catch (StatusClientException scx)
{
	if (scx.Error != null)
	{
		Console.WriteLine(string.Format("Code = {0}\r\nResponseCode = {1} \r\nMessage: \r\n{2}\r\nTarget: \r\n{3}",
			scx.Error.Code, scx.Error.ResponseCode, scx.Error.Message, scx.Error.Target));
		if (scx.Error.Details != null)
		{
			foreach (Detail error in scx.Error.Details)
			{
				Console.WriteLine(string.Format("INNER ERROR: Code = {0} \r\nMessage: \r\n{1}\r\nTarget: \r\n{2}",
					error.Code, error.Message, error.Target));
			}
		}
	}
}
catch (Exception ex)
{
	Console.WriteLine(string.Format("Message = {0}", ex.Message));
}

Console.WriteLine("Request completed...");
Console.ReadKey();

 

Access

To access to Mainfreight APIs, you have to Register

NOTE: Content in the panels below this point are not visible on the site unless used by other features e.g. gadgets, OB&E, etc.