Interfaces - Express

- FetchPOD service
- GetQuote service
- PlaceCollection service
- SubmitWaybill service (Aramex)
- TrackAndTrace service

* GetCollectionDates service
* GetCollectionList service
* GetCompany service
* GetCustomer service
* GetHubs service
* GetMyCourier service
* GetPostalCodes service
* GetQuoteList service
* GetRegions service
* GetServiceTypes service
* GetSites service
* GetSpendBy service
* GetStatement service
* GetTransactions service
* GetTransactionTypes service
* GetUser service
* GetWaybillActivity service
* GetWaybillList service

* These services are disabled

TrackAndTrace Service

Service Overview

Web Service URL - http://service.bercoexpress.co.za/rest/trackandtrace

Service Input Methods - GET PUT POST


This service can be used to retrieve tracking information related to a particular shipment. Tracking is facilitated through the waybill number field (see field description for more information.

Get Requests

Use the following url sample to make a GET request to this service. Remember to set the content-type header in your request to control the format of the data returned. Please note that get requests have a limitation on the length of URLs, which varies from system to system. We recommend using the POST or PUT methods for best results.

URL - http://service.bercoexpress.co.za/rest/rest/trackandtrace?waybill_no=string&customer_code=string&password=string&request_recs=integer&live_transaction=string&user_id=string&next_record=string

Input Variables
customer_codestring value expected. The account code allocated to a Berco customer.
live_transactionstring value of 'Y' or 'N' expected. This value is used to indicate to the Freight systems whether to treat this transaction as a test or live transaction. PLEASE NOTE: For this test website, service requests will always be submitted as 'N' regardless of what this value is set to.
next_recordstring value expected. If you received a value in a previous call to this service, you can use it to retrieve the next batch of records in the sequence of values.
passwordstring value expected. The password used for logging onto the Berco website.
request_recsinteger value expected. This value (along with the 'next record' value) can be used to control the number of transaction records returned in the result record. Default value is 30
user_idstring value expected. The user id used for logging onto the Berco website.
waybill_nostring value expected. The unique shipment identifier used by Berco to track individual shipments.

Output Variables
codeinteger value. The status of the transaction. '0' indicates successful transaction.
code_descriptionstring value. A brief description of the status code received.
event_codestring value. Part of 'event_outputs' array object values. Internal Freight description code describing the type of event that took place.
event_datedate value in format YYYY-MM-DD. Part of 'event_outputs' array object values. Date in which the event took place.
event_descstring value. Part of 'event_outputs' array object values. Description of the event that took place.
event_driverstring value. Part of 'event_outputs' array object values. Name of the driver involved in the specified event (if any),
event_locationstring value. Part of 'event_outputs' array object values. Location or branch where event took place.
event_outputsarray value. An array value holding a list of all event outputs for this request. The array object consists of the following fields: pod_image_code, event_code, event_date, event_desc, event_driver, event_date, event_location, event_time.
event_timetime value in HH:MM format. Part of 'event_outputs' array object values. Time in which the event took place.
next_recordstring value. If you receive this value it indicates that more records can be retrieved by setting the 'next_record' field to this value. If this value is an empty string, it indicates no more records can be retrieved.
pod_image_codeinteger value. Part of 'event_outputs' array object values. POD Image description flag. 0 = no image available, 2 = image available, 3 = image archived.

Code Samples

The following code samples are available: Perl  Python

#!/usr/bin/env perl

use Data::Dumper;
use LWP::UserAgent;
use JSON::Any;
use strict;
use warnings;

print "Running test for web services\n";
my $url = 'http://service.bercoexpress.co.za/rest/';
my $client = LWP::UserAgent->new;
$client->agent('presserCORE Interface/0.1 - testcase');

my $j = JSON::Any->new;

my ( $inputs, $obj, $req, $res, $content ); 

print "\n\ntesting trackandtrace service\n"; 

$inputs = {};
$inputs->{live_transaction} = 'n';
$inputs->{user_id} = 'btest';
$inputs->{password} = 'btest';
$inputs->{customer_code} = 'b10128';
$inputs->{request_recs} = 30;
$inputs->{next_record} = '';
$inputs->{waybill_no} = '22871327';

print "\n\ntesting service with json:\n";

$obj = $j->objToJson($inputs);

$req = HTTP::Request->new(POST => $url.'getuser');
$req->content_type('application/json'); # using JSON for request

$res = $client->request($req);
$content = $res->content;

print "json values submitted:\n";
print $obj;

print "\n\nvalues received as perl hash:\n";
print Dumper( $j->jsonToObj($content) );



import simplejson
import urllib2

print "Running test for web services";
url = 'http://service.bercoexpress.co.za/rest/';

print "\n\ntesting trackandtrace service"

inputs = {
	'live_transaction':		'N',
	'user_id':				'btest', # test user id
	'password':				'btest', # test user password
	'customer_code':		'b10128',
	'request_recs':			30,
	'next_record':			'',
	'waybill_no':			'22871327',

url = '%s%s' % (url, 'trackandtrace')

inputs_json = simplejson.dumps(inputs)

req = urllib2.Request(url=url, data=inputs_json)
req.add_header('Content-Type', 'application/json') # using JSON for request

result = urllib2.urlopen(req)

content = result.read()

print "\n\njson values submitted:\n" + inputs_json

print "\n\noutput values received as python dictionary:\n"
print simplejson.loads(content)


Test Form

Service test form for service TrackAndTrace. All requests submitted via this service will be sent to the test environment, regardless of what variable "live_transaction" is set to. Some test values have been included in the test form for your convenience, please feel free to adjust values as required to see the different results returned by the service. Results will be returned in JSON format, please see the 'Service Overview' tab for detailed explanation on output fields.

For information on mandatory fields and expected inputs, please refer to the "Status Codes" and "Service Overview" tabs.


Status Codes

This page contains a list of all the status codes that could be returned by this service. A brief description of each code is also included.

0Transaction completed successfully
10Invalid value received for 'live_transaction' (expecting 'y' or 'n') - transaction terminated
11Invalid value received for 'request_recs' expecting positive integer value - transaction terminated
12null or empty string received for 'user_id' - transaction terminated
13null or empty string received for 'password' - transaction terminated
200An internal rest service error has occurred - this is a technical fault with the actual server side processing. Please contact the System Administrator - transaction terminated
36null or empty string received for 'waybill_no' - transaction terminated
40000A transaction error has occurred with the internal Freight systems - this is a technical fault with the actual server side function. Please contact the System Administrator - transaction terminated
40001Access denied - authorisation failed. Incorrect username and/or password
40502The requested records value received exceeds the max allowed value of 30 - unable to process request
40503The submitted waybill number was not found - unable to process request
59999An unexpected error condition has been returned by the Freight systems - this could indicate an internal error or possibly an uncaught exception with the input data. Please contact the System Administrator - transaction terminated