1.       Shipping Calculator API

This document outlines the specifications required for the clients who require access to our API system to generate electronic labels.

EziShipping provides its API consignment generation in JSON format.

Please note non-payment of Account may result in immediate suspension of access to all our system including APIs.

Abstract

This document is about the technical details and how you can integrate shipping calculation into your website and how to use the APIs.

Before you start

You need to apply to get an account and password for shipping calculator API access, when this is approved you will have Account name, Password, and a token unique for you.

What do I need to provide?

Because this service will be fixed and will be available for only one IP, you need to provide the IP address of the hosting you will be using calling the API. The reason for that is to prevent the accounts data to be shared and we can provide better service for the valuable customers. If you changed the hosting or for some reason the IP you provided at the beginning is changed, you need to send the updated IP address to SAMPSON EXPRESS.

What Language should I use?

This is a web-based API service, and you can use any service, as long as you can pass the parameters to SAMPSON EXPRESS web server and you can pars the response, you can use it.

What parameters do I need to send?

To get a proper and exact shipping price you need to send these parameters to the API (all parameters are mandatory):

Variable Description
User This is the username provided to you by the carrier
Key Unique key string
TP The postcode item will be delivered to
FP Suburb item will be picked up
FS Suburb item will picked up
TS Suburb item will be delivered to
Service type An array of service type and carrier account

Services for request are:

EXPFP (Full Pallet), EXPHP (Half Pallet),
EXPKG (KG Service)

Items An Array of dimensions (in cm) and width(in kg) and quantity

W: width (cm)

H: Height (cm)

D: Depth (cm)

K: Weight (kg)

Q: Quantity

You need to send the parameters as a string in a JSON format, variable name for the JSON is called R. Note that the items should be in an array format, even if it is only one item. Dimensions are in cm, and weight is in Kg.

Method you need to use when sending parameters should be POST method. And the URL you need to use is

HTTP Methods POST
Authentication method Basic Auth
API URL
MRL Logistics
https://api.mrllogistics.com/v3.4/customers/{CustomerID}/shipping/
API URL
Sampson Express
https://api.sampsonexpress.com.au/v3.4/customers/{CustomerID}/shipping/

A sample php code

Sample Body:

{
    "fromPostcode": "3030",
    "fromSuburb": "Derrimut",
    "toPostcode": "2565",
    "toSuburb": "INGLEBURN",
    "services": [{
            "account": "PLT5727",
            "service": "EXPFP"
        },
        {
            "account": "PLT5727",
            "service": "EXPHP"
        }
    ],
    "items": [{
        "width": 120,
        "length": 120,
        "height": 100,
        "weight": 120,
        "qty": 1

    }, {
        "width": 120,
        "length": 120,
        "height": 120,
        "weight": 500,
        "qty": 1
    }]
}

This php code works as a proxy server between the client who send the request and SAMPSON EXPRESS server. You cannot send the shipping request directly from browser using ajax, or form submit, because SAMPSON EXPRESS API service will only answer to the requests coming from the registered IP address for the account.

Response

Response which you will receive will be a XML format, but the data will be returned to you in JSON format.

 

Sample Response:

{
    "success": true,
    "error": {
        "code": 0,
        "message": ""
    },
    "response": {
        "1": {
            "Service": "EXPFP",
            "TotalEx": "352.66",
            "FSC": "44.66",
            "SSC": "0",
            "GST": "35.266",
            "TotalInc": "387.926",
            "Account": "PLT5727",
            "UD": "2019-02-12 13:36:10",
            "FSuburb": "Derrimut",
            "FPostcode": "3030",
            "TSuburb": "INGLEBURN",
            "TPostcode": "2565",
            "From": "Derrimut [3030]",
            "To": "INGLEBURN [2565]",
            "Comment": null
        },
        "2": {
            "Service": "EXPHP",
            "TotalEx": "352.66",
            "FSC": "44.66",
            "SSC": "0",
            "GST": "35.266",
            "TotalInc": "387.926",
            "Account": "PLT5727",
            "UD": "2019-02-12 13:36:10",
            "FSuburb": "Derrimut",
            "FPostcode": "3030",
            "TSuburb": "INGLEBURN",
            "TPostcode": "2565",
            "From": "Derrimut [3030]",
            "To": "INGLEBURN [2565]",
            "Comment": null
        }
    }
}

Response fields:
Service: Shipping service type, which is the same as the one it was requested.
TotalEx: Is total price excluding GST
FSC: Fuel Surcharge
SSC: Security Surcharge
GST: GST
TotalInc: Total price including GST
Account: Carrier Account number
UD: The date and time price is calculated
FSuburb: pickup suburb
FPostcode: Pickup postcode
TSuburb: Destination suburb
TPostcode: Destination postcode
Comment: Will include some comments if required such as invalid address

If you require any further information / assistance, please feel free to contact us through https://www.mrlglobal.com/contact-us/.