Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 33 Next »

This guide is intended for developers who want to integrate their own applications with PortConnect.

Contents

What is the PortConnect API?


The PortConnect API (Application programming interface) is a new, more modern way of sending and retrieving data from PortConnect.  PortConnect receives container event information 24 hours a day from our partner ports Ports of Auckland, Port of Tauranga and the Timaru Container Terminal.  Events are received at least every ten minutes.

All API operations work for all partner ports.

  • Scheduled vessels: Returns scheduled vessel information, including expected time of arrival and departure.
  • Containers: Returns the latest detailed information for specified containers.  Up to 10 containers can be searched at any one time.
  • Container event subscriptions: This is a suite of operations which allows container events to be sent to any end point you specify.


Getting Started


In order to use the PortConnect API, you need to sign up to our Microsoft APIM based developer portal, which is located at https://developer.portconnect.io.  Signing up is free of charge.  

Once signed up, you will be able to subscribe to either the Full Access or Trial product variations for the API, via the "Products" menu.  Both products contain the same API end points, and both products require you to accept the PortConnect API terms and conditions of use.

The Trial version restricts the number of requests that you can make to an API end point to 100 calls within a 24 hour period.  Full Access has no restrictions on the number of requests you can make, however some charges may apply.

Once the subscription is confirmed, an API key will be generated.  You can see your API key from the profile menu. 

All calls to the PortConnect API must include either the primary or secondary key in the header Ocp-Apim-Subscription-Key.  You can regenerate your subscription key any time you choose.

You can test the PortConnect API directly from the developer portal or, if you prefer, from other API tools such as Postman.  See the resources section below for some Postman tests you can use.

The PortConnect API endpoint to use from your client is https://api.portconnect.io.  You can see this when you try out the PortConnect API, as the request url and the http request are generated for you. For example:

API Endpoints


Scheduled Vessels

This end point returns vessels that are scheduled to arrive at our partner ports. It can also be used to query vessels currently in port and vessels that have recently departed. This data is updated approximately every 15 minutes.

Refer to the scheduled vessels documentation in the  developer portal for details on parameters you can use:

Examples

This request will return all commercial vessels (excludes cruise ships) for Auckland that are expected to arrive between 2nd May 12:00am and 31st May 12:00 am:

https://api.portconnect.io/v1/scheduled-vessels?portCode=NZAKL&vesselType=COMMERCIAL&vesselStatus=EXPECTED&arrivalDateFrom=2019-05-02&arrivalDateTo=2019-05-31

This request will return all commercial vessels (excludes cruise ships) for Auckland that are expected to arrive between 1:00pm and 2:00pm on the 2nd May.  Times are NZ Daylight saving:

https://api.portconnect.io/v1/scheduled-vessels?portCode=NZAKL&vesselType=COMMERCIAL&vesselStatus=EXPECTED&arrivalDateFrom=2019-05-02T13:00:00&arrivalDateTo=2019-05-02T14:00:00

Response

The response data is the same as that returned via the vessel schedule screen on the PortConnect website, and should be self-explanatory:

Scheduled Vessel Response
[{
  "vesselVisitReference": "TEM6916",
  "vesselName": "THEMIS",
  "imoNumber": "9722314",
  "inboundVoyage": "FF920",
  "outboundVoyage": "FF920",
  "vesselStatus": "EXPECTED",
  "vesselType": "COMMERCIAL",
  "portCode": "NZAKL",
  "wharfName": "BLEDISLOE",
  "previousPortName": "MANZANILLO",
  "nextPortName": "BRISBANE",
  "vesselOperator": "WILHELMSEN LINES NZ LTD",
  "serviceCode": "WILHELMSEN SERVICE",
  "arrivalDatetime": "2019-05-02T13:30:00+12:00",
  "departureDatetime": "2019-05-02T23:34:00+12:00",
  "receivalCommenceInland": null,
  "receivalCommenceSeaport": null,
  "receivalCutoffInland": null,
  "receivalCutoffSeaport": null,
  "lastUpdatedDateTime": "2019-05-02T13:05:21.913+12:00"
}]

Container Visits

In PortConnect terminology, a container visit refers to a container passing through a partner port.  The container visit might be an import, export, transhipment or a domestic supply chain movement.

Using the container visits search API, you can search for a single container or up to 10 containers in a single call. 

Examples

The following api request will return information on the containers TCLU5458530 and TCLU5614930 for Auckland:

https://api.portconnect.io/v1/container-visits?containerNumber=TCLU5458530&portCode=NZAKL&containerNumber=TCLU5614930

Response

The response contains the currently active or the most recent container visit record, and the field names should be self explanatory:

Example response
[{
  "containerVisitId": 7616216,
  "portCode": "NZTRG",
  "category": "EXPORT",
  "containerNumber": "MSKU1512500",
  "shipmentDirection": "OUTBOUND",
  "inboundVesselRef": null,
  "inboundVesselName": null,
  "inboundVesselPublishedArrivalDatetime": null,
  "inboundVesselActualArrivalDatetime": null,
  "inboundVesselPublishedDepartureDatetime": null,
  "inboundVesselActualDepartureDatetime": null,
  "outboundVesselRef": "RIB917N",
  "outboundVesselName": "RIO BLANCO",
  "outboundVesselPublishedArrivalDatetime": "2019-05-05T15:30:00+12:00",
  "outboundVesselActualArrivalDatetime": null,
  "outboundVesselPublishedDepartureDatetime": "2019-05-06T21:30:00+12:00",
  "outboundVesselActualDepartureDatetime": null,
  "containerIsoTypeCode": "4510",
  "containerIsoTypeDescription": "40' 9'6 HIGH CUBE",
  "declaredWeight": 30430.0,
  "declaredWeightVgm": true,
  "commodityCode": "FAK",
  "containerStatus": "FULL",
  "requiredTemperature": 0.0,
  "ventSetting": null,
  "o2Percent": null,
  "cO2Percent": null,
  "humidityPercent": null,
  "packedOffPowerDatetime": null,
  "PackedOffPowerTemp": null,
  "maxHoursAllowedOffPower": null,
  "containerOperatorCode": "MAEU",
  "containerOperatorName": "Maersk Line",
  "containerOperatorVoyageId": "917N",
  "loadPortCode": "NZTRG",
  "loadPortName": "Tauranga",
  "dischargePortCode": "MYTPP",
  "dischargePortName": "Tanjung Pelepas",
  "destinationPortCode": "INVTZ",
  "destinationPortName": "Visakhapatnam",
  "inlandPortArrivalDatetime": null,
  "inlandPortCarrier": null,
  "seaPortCarrier": "B340 (Road)",
  "loadDatetime": null,
  "receivedDatetime": "2019-05-02T13:44:31.017+12:00",
  "inlandPortInboundCarrier": null,
  "seaPortArrivalDatetime": "2019-05-02T13:44:31.017+12:00",
  "seaPortInboundCarrier": "B340 (Road)",
  "bookingReference": "968486382",
  "cedoNumberCode": null,
  "dischargedDatetime": null,
  "deliveredDatetime": null,
  "securityCheck": null,
  "lastFreeDatetime": null,
  "lineReleaseDatetime": null,
  "customsReleaseDatetime": null,
  "mpiReleaseDatetime": null,
  "containerLocation": "YARD",
  "emptyReturnDepotCode": null,
  "emptyReturnDepotName": null,
  "sealCount": 1,
  "hazardCount": 0,
  "stopCount": 1,
  "oversizeCount": 0,
  "seals": [{
    "containerSealTypeCode": "Other",
    "containerSealValue": "FJO3729049"
  }],
  "hazards": [],
  "stops": [{
    "stopTypeCode": "!NO VGM NO VESSEL LOAD"
  }],
  "oversizes": []
}]

Returning a single container visit

If you have a single container visit id, which is a PortConnect reference to a unique container visit, you can also retrieve container data by putting the id in the path of the container visits uri.  For instance this request returns the same information as the above example:

https://api.portconnect.io/v1/container-visits/7616216

Container Event Subscriptions

Use container event subscriptions, or "subscriptions", when you want PortConnect to send you an http callback when a particular container event occurs.  This is an alternative to the email / xml based notifications which are also operated by PortConnect.

Creating a Subscription

To receive callbacks for particular container events, you need to create a subscription by posting to the subscriptions endpoint.   Each subscription relates to a single event type, however multiple containers can be included. 

Example

For example, the following subscription request will result in a webhook callback when any of the three specified containers become available:

Subscription Create Example
POST https://api.portconnect.io/v1/subscriptions HTTP/1.1
Host: api.portconnect.io
Content-Type: application/json
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

{
  "containers": [
    { "containerNumber": "MEDU3085895", "userDefinedReference" : "User ref 1"},
    { "containerNumber": "APHU6303593", "userDefinedReference" : "User ref 2"},
    { "containerNumber": "MEDU5129708", "userDefinedReference" : "User ref 3"}
  ],
  "webhookURI": "https://api.yourcompany.co.nz/webhooks/portconnect",
  "webhookToken": "yoursecret",
  "portCode": "NZTRG",
  "category": "IMPORT",
  "eventTypeCode": "AVAILABLE",
  "facilityCode": null
}

Request Validation Rules

You must specify the uri location where you want the webhook callback to be sent, and optionally a token that you can use to verify the call.

A new subscription is created for every unique combination of PortCode, Category, EventTypeCode and FacilityCode .  If a subscription already exists for a particular combination, then containers are added to that subscription.

  • Valid port codes are: NZAKL, NZTRG, NZTIU
  • Valid category codes are: IMPORT, EXPORT, TRANSHIPMENT, DOMESTIC
  • Facility codes are optional and relate to the port facility where the event takes place. If no facility code is specified, then webhook callbacks will be sent whenever the event occurs, regardless of the location.  For instance, if a subscription is created for an export "gate in", and the container is gated in to both an inland port and the sea port, then two gate in events will be sent as webhook callbacks.
  • Only some event type codes support the use of the facility code, in all other cases a null value should be supplied.  Refer to the table below.

User Defined References

  • We only permit one userDefinedReference per container. This is a maximum of 50 characters and designed to support container visit identifiers in calling systems.
  • The user defined reference will be included in the webhook callback payload against the specified container.
  • If you create a new subscription with a different user defined reference, it will overwrite the existing subscription including the user defined reference.
  • If you have already received events against the first subscription you will receive future events against the new subscription with the new user defined reference.


Notification Types

Valid event type codes are shown in the following table, along with event values that are returned in the webhook callback payload:

Code
Description
Supported Facility Codes
Event Value 1Event Value 2
ACTIVEContainer record becomes live in PortConnect systemNZAKL, NZTRG, NZTIU

AVAILABLEAvailability Advice (Container is fully released)NZAKL, NZTRG, NZTIU

AVAILABLECANCELLEDAvailability Advice cancelledNZAKL, NZTRG, NZTIU

BOOKINGDISCREPANCYDiscrepancy: Booking does not match Preadvise/Gate-in detailsNZAKL, NZTRG, NZTIUContainer Visit valueBooking value
CLEAREDCleared Advice (Container is fully cleared)NZAKL, NZTRG, NZTIU

CLEAREDCANCELLEDCleared Advice cancelledNZAKL, NZTRG, NZTIU

CUSTOMSRELEASENotice of Customs ReleaseNZAKL, NZMKL, NZTRG, NZTIU, NZOLT

CUSTOMSRELEASECANCELLEDNotice of Customs Release cancelledNZAKL, NZMKL, NZTRG, NZTIU, NZOLT

DEPARTFacility Departure AdviceNZAKL, NZWII

DISCHARGEDischarge AdviceNZAKL, NZTRG, NZTIU

EXPORTCLEAREDCEDO is in place and there are no other stopsNZAKL, NZTRG, NZTIU

EXPORTCLEAREDCANCELLEDExport Cleared cancelledNZAKL, NZTRG, NZTIU

GATEINGate IN adviceNZAKL, NZMKL, NZTRG, NZWII, NZTIU, NZOLTMode of transport, eg. RoadIdentifier for the truck or train, eg. REL328
GATEOUTGate OUT AdviceNZAKL, NZMKL, NZTRG, NZWII, NZTIU, NZOLTMode of transport, eg. RoadIdentifier for the truck or train, eg. REL328
HAZARDGATERULEHazardous Cargo Gate-in rule appliesNZAKL, NZTRG, NZTIU

LFT24HOURSContainer visit Last Free Time within 24 hoursNZAKL, NZTRG, NZTIULast free time
LFTCHANGEDContainer visit Last Free Time has been changedNZAKL, NZTRG, NZTIUNew last free time
LFTEXCEEDEDContainer visit Last Free Time exceededNZAKL, NZTRG, NZTIULast free time
LOADNotice of item loaded to VesselNZAKL, NZTRG, NZTIU

LOPRELEASENotice of Line Operator ReleaseNZAKL, NZMKL, NZTRG, NZTIU, NZOLT

LOPRELEASECANCELLEDNotice of Line Operator Release - cancelledNZAKL, NZMKL, NZTRG, NZTIU, NZOLT

MPIRELEASENotice of MPI ReleaseNZAKL, NZMKL, NZTRG, NZTIU, NZOLT

MPIRELEASECANCELLEDNotice of MPI Release - cancelledNZAKL, NZTRG, NZTIU

NOCEDONo Cedo WarningNZAKL, NZTRG, NZTIU48, 24, 2 hour warning text
PINAVAILABLEExpressPin AvailableNZAKLExpress Pin number
PINSUSPENDEDExpressPin SuspendedNZAKLExpress Pin number
VESSELARRIVALVessel Visit Actual Time of ArrivalNZAKL, NZTRG, NZTIU

VESSELDEPARTUREVessel Visit Actual Time of DepartureNZAKL, NZTRG, NZTIU

PRIORITYGATEINAutomated Gate-In Notifications when containers arrive at Metroport with a status of Priority (Only available for Imports via Port of Tauranga).NZTRG

Facility codes:

  • NZAKL - Ports of Auckland 
  • NZMKL - MetroPort Auckland
  • NZCWF - Crawford Street, Hamilton
  • NZTRG - Port of Tauranga, Sulphur Point
  • NZWII - Wiri, Ports of Auckland South Auckland Freight Hub
  • NZTIU - Timaru Container Terminal
  • NZOLT - MetroPort Rolleston

Response

Success will result in a return code of 201 Created. The response to the request will confirm the subscription details. 

Subscription Create Response
{
    "subscriptionId": 9,
    "containers": [
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 12,
            "containerNumber": "APHU6303593",
            "userDefinedReference" : "User ref 1"
        },
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 11,
            "containerNumber": "MEDU3085895",
            "userDefinedReference" : "User ref 2"
        },
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 13,
            "containerNumber": "MEDU5129708",
            "userDefinedReference" : "User ref 3"
        }
    ]
}

The response includes a subscription id.  You can use the subscription id as a handle for future get, update and delete calls.

Each container includes a subscriptionContainerId, which you can use as a reference as this is passed back in the webhook payload. 

The expiration datetime for the container is also shown.  Each container in a subscription has an expiration date of the creation date plus 60 calendar days.  After this time no callbacks will be made for the container, and the container is no longer returned when querying the subscription. Calling the subscription create event with the same container number will extend the expiration datetime.

Webhook Callback Payload

When PortConnect detects an event that matches your subscription, it will send an HTTP POST to your specified end point.  Event matching happens when new events are processed into the PortConnect system,and also when the subscription is first created (for events that have occurred for a currently active container).

For testing purposes, you may find it useful to create a webhook uri using Request Bin or similar.  This allows you to easily view the webhook payload.

Example

Multiple events may be returned in a single payload, as in this example:

Webhook Callback Payload
[
    {
        "subscriptionEventId": 13752,
        "subscriptionId": 9,
        "partnerPortCode": "NZAKL",
        "containerVisitTypeCode": "EXPORT",
        "containerVisitEventTypeCode": "GATEIN",
        "containerVisitEventDatetime": "2019-06-19T12:41:02+12:00",
        "containerVisitEventLocation": "NZAKL",
        "containerNumber": "APHU6303593",
        "containerIsoTypeCode": "4510",
        "containerVisitUri": "v1/container-visit/5046168",
        "subscriptionContainerId": 12,
        "userDefinedReference": "User ref 1",
        "containerVisitEventValue": "Road",
        "containerVisitEventValue2": "REL328",
        "inboundVesselRef":null,
        "inboundVesselName":null,
        "inboundVesselIMONumber":null,
        "outboundVesselRef":"KOC0130",
        "outboundVesselName":"KOTA LOCENG",
        "outboundVesselIMONumber":9628336
    },
	{
        "subscriptionEventId": 13752,
        "subscriptionId": 9,
        "partnerPortCode": "NZAKL",
        "containerVisitTypeCode": "EXPORT",
        "containerVisitEventTypeCode": "GATEIN",
        "containerVisitEventDatetime": "2019-06-19T12:41:02+12:00",
        "containerVisitEventLocation": "NZAKL",
        "containerNumber": "MEDU3085895",
		"containerIsoTypeCode": "2210",
        "containerVisitUri": "v1/container-visit/5046572",
        "subscriptionContainerId": 11,
        "userDefinedReference": "User ref 2",
        "containerVisitEventValue": "Road",
        "containerVisitEventValue2": "REL328",
        "inboundVesselRef":null,
        "inboundVesselName":null,
        "inboundVesselIMONumber":null,
        "outboundVesselRef":"KOC0130",
        "outboundVesselName":"KOTA LOCENG",
        "outboundVesselIMONumber":9628336
    },
	{
        "subscriptionEventId": 13752,
        "subscriptionId": 9,
        "partnerPortCode": "NZAKL",
        "containerVisitTypeCode": "EXPORT",
        "containerVisitEventTypeCode": "GATEIN",
        "containerVisitEventDatetime": "2019-06-19T12:41:02+12:00",
        "containerVisitEventLocation": "NZAKL",
        "containerNumber": "MEDU5129708",
		"containerIsoTypeCode": "2210",
        "containerVisitUri": "v1/container-visit/5046997",
        "subscriptionContainerId": 13,
        "userDefinedReference": "User ref 3",
        "containerVisitEventValue": "Road",
        "containerVisitEventValue2": "REL328",
        "inboundVesselRef":null,
        "inboundVesselName":null,
        "inboundVesselIMONumber":null,
        "outboundVesselRef":"KOC0130",
        "outboundVesselName":"KOTA LOCENG",
        "outboundVesselIMONumber":9628336
    }
]

Included as a header key of the callback is a value X-WebhookToken which you can choose to validate as the webhookToken value specified when creating the subscription.   This is designed to help protect your webhook end point from unauthorised access.

If you require additional information about the container visit, call the containerVisitUri returned.  Refer to the Container Visits section for details.

Searching All Subscriptions

You can search for all active container event subscriptions for your API user by calling the subscriptions end point:

Example

https://api.portconnect.io/v1/subscriptions

Response

The response payload lists all of you current subscriptions, for example:

Subscription Search
[{
        "subscriptionId": 9,
        "containers": [
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 12,
            "containerNumber": "APHU6303593",
            "userDefinedReference" : "User ref 1"
        },
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 11,
            "containerNumber": "MEDU3085895",
            "userDefinedReference" : "User ref 2"
        },
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 13,
            "containerNumber": "MEDU5129708",
            "userDefinedReference" : "User ref 3"
        }
        ],
        "webhookURI": "https://enhct6aieo9t7.x.pipedream.net",
        "webhookToken": "123-456-789-000",
        "portCode": "NZAKL",
        "category": "IMPORT",
        "eventTypeCode": "CUSTOMSRELEASE",
        "facilityCode": ""
    },
    {
        "subscriptionId": 10,
        "containers": [
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 12,
            "containerNumber": "APHU6303593",
            "userDefinedReference" : "User ref 1"
        },
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 11,
            "containerNumber": "MEDU3085895",
            "userDefinedReference" : "User ref 2"
        },
        {
            "expirationDatetime": "2019-08-19T10:51:29.163+12:00",
            "subscriptionContainerId": 13,
            "containerNumber": "MEDU5129708",
            "userDefinedReference" : "User ref 3"
        }
        ],
        "webhookURI": "https://enhct6aieo9t7.x.pipedream.net",
        "webhookToken": "123-456-789-000",
        "portCode": "NZAKL",
        "category": "IMPORT",
        "eventTypeCode": "AVAILABLE",
        "facilityCode": ""
    }]

Searching for a Single Subscription

If you know the subscription id, you can search for the details of a single subscription:

Example

The following example returns the subscription details for subscription 9:

https://api.portconnect.io/v1/subscriptions/9

Response

The response payload lists all of you current subscriptions, for example:

Subscription Search
{
        "subscriptionId": 9,
        "containers": [
            {
                "expirationDatetime": "2019-08-19T11:07:19.883+12:00",
                "subscriptionContainerId": 12,
                "containerNumber": "APHU6303593",
                "userDefinedReference" : "User ref 1"
            },
            {
                "expirationDatetime": "2019-08-19T11:07:19.883+12:00",
                "subscriptionContainerId": 11,
                "containerNumber": "MEDU3085895",
                "userDefinedReference" : "User ref 2"
            },
            {
                "expirationDatetime": "2019-08-19T11:07:19.883+12:00",
                "subscriptionContainerId": 13,
                "containerNumber": "MEDU5129708",
				"userDefinedReference" : "User ref 3"
            }
        ],
        "webhookURI": "https://enhct6aieo9t7.x.pipedream.net",
        "webhookToken": "123-456-789-000",
        "portCode": "NZAKL",
        "category": "IMPORT",
        "eventTypeCode": "CUSTOMSRELEASE",
        "facilityCode": ""
    }

Updating Subscriptions

A single subscription can be updated by sending a patch to the subscriptions end point, specifying the subscription id in the uri. 

Any containers supplied replace all existing containers in the subscription.

You can update the port code, category, event type and facility codes if you wish, but this isn't recommended as a different subscription id can result, possibly causing confusion.

Example

For instance, subscription id w can be updated to include containers:

Subscription Update
PATCH https://api.portconnect.io/v1/subscriptions/2 HTTP/1.1
Host: api.portconnect.io
Content-Type: application/json
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

{
"containers": [
    { "containerNumber": "CNIU2234429"},
    { "containerNumber": "CNIU2234430"},
    { "containerNumber": "CNIU2234431"},
    ],
  "webhookURI": "https://api.yourdomain.com/portconnect",
  "webhookToken": "secretsquirrel",
  "portCode": "NZAKL",
  "category": "IMPORT",
  "eventTypeCode": "AVAILABLE",
  "facilityCode": ""
}

Response

A return code of 204 indicates the subscription has been updated successfully.

Deleting Subscriptions

Subscriptions may be deleted by sending a delete request with an empty request body to the subscriptions end point.

Example

Subscription Delete
DELETE https://api.portconnect.io/v1/subscriptions/3 HTTP/1.1
Host: api.portconnect.io
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

Response

A return code of 204 indicates the subscription has been deleted successfully.


Shipping Line Endpoints


PortConnect offers the following end points exclusively for the use of shipping lines.  Shipping line developers will need to contact our user support team to have access to these endpoints.   PortConnect associates an API user id with a specific line operator, so that storage pre-advice and booking api calls are associated with the correct shipping line.   It isn't possible to send or retrieve information in relation to other shipping lines.

Storage Pre-Advice (Ports of Auckland Only)

Shipping lines have the ability to pre-advise the arrival of storage containers to the LINK facility at the Ports of Auckland via this end point.  Containers cannot be gated in to the LINK facility unless they have been pre-advised in advance.

Import containers where the LINK facility has been specified by the shipping line as the return depot will automatically have a pre-advice generate for them at gate out.  This applies to import containers at both Ports of Auckland and Port of Tauranga, including associated inland ports.

Storage pre-advice should be submitted for the LINK facility when:

  1. An import has been gated out where an empty return depot other than LINK was specified or;
  2. An import has been gated out from a port other the Ports of Auckland or Port of Tauranga

Submitting a Storage Pre-Advice

A storage pre-advice can be submitted by posting to the lines/storage-pre-advices endpoint.

Example

Storage pre-advice submit
POST https://api.portconnect.io/lines/v1/storage-pre-advices HTTP/1.1
Host: api.portconnect.io
Content-Type: application/json
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

{
  "portCode": "NZAKL",
  "containers": [
    {
      "containerNumber": "MSKU1512500",
      "containerIsoTypeCode": "4510"
    }
  ],
  "receiveLocation": "LNK"
}

Validation

At this time the only supported value for portCode is "NZAKL", and the only supported value for receiveLocation is "LNK"

Response

Success will result in a return code of 201 Created.

Any errors will result in a return code of 400 Bad request.  Further information will be supplied in the message payload.

Bookings

Container bookings are used by PortConnect to validate the creation of export pre-advice messages.

Bookings have traditionally been supplied via EDIFACT messages such as COPARN.  PortConnect has created a set of endpoints that allows shipping lines to submit, retrieve and delete bookings from the PortConnect system.

Submit a Booking

A booking consists of top level booking information and one or more booking items.   Each booking item can optionally have hazardous and conditioning information. 

Example

Submit a Booking
POST https://api.portconnect.io/lines/v1/bookings HTTP/1.1
Host: api.portconnect.io
Content-Type: application/json
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
{
	"bookingNbr": "0AKL005396",
	"partnerPortCode": "NZTRG",
	"vesselVisit": {
		"vesselName": "BROTONNE BRIDGE",
		"vesselIMO": "9486116",
		"vesselCallSign": "",
		"vesselVoyageNbr": "010N",
		"vesselReference": "ROT010N"
	},
	"msgReferenceNbr": "132576",
	"shipperName": "BOLLORE LOGISTICS NEW ZEALAND LTD",
	"consigneeName": "",
	"loadPortCode": "NZTRG",
	"dischargePortCode": "PFPPT",
	"finalDestinationPortCode": "PFPPT",
	"originPortCode": null,
	"bookingCategoryCode": "Export",
	"items": [{
			"isoTypeCode": "2232",
			"quantity": 1.0,
			"bookingStatus": "FCL",
			"grossWeightKg": 14148.0,
			"commodityDesc": "FOOD:(NOS,CHILLED)",
			"temperatureRequired": 2.0,
			"oversizeFrontCm": null,
			"oversizeBackCm": null,
			"oversizeLeftCm": null,
			"oversizeRightCm": null,
			"oversizeTopCm": null,
			"hazards": [{
					"unHazardNumber": "1950",
					"imdgClass": "2.2"
				}
			],
			"conditioning": {
				"cO2Required": null,
				"o2Required": null,
				"humidityRequired": null,
				"ventRequired": 25.0,
				"ventRequiredUnit": "FlowM3PerHour"
			}
		}
	]
}

Validation

The following validation rules apply:

  • partnerPortCode must be one of NZAKL or NZTRG
  • vesselVisit must contain a minimum of vesselName and vesselVoyageNbr
  • valid UN port codes must be used
  • at least one booking item must be supplied

Response

Success will result in a return code of 201 Created.

Any errors will result in a return code of 400 Bad request.  Further information will be supplied in the message payload.

Retrieve a Booking

A booking can be retrieved by sending a get request. 

Example

The following example retrieves the booking above:

Retrieve a booking
https://api.portconnect.io/lines/v1/bookings/0AKL005396

Response

Success will result in a return code of 200 Ok.

A return code of 200 ok will also result if a booking is not found for the line operator, or if the booking has been cancelled.

Cancel a Booking

A booking can be cancelled in the PortConnect system by sending a delete request with an empty request body to the bookings end point, specifying the booking you want to delete.

Example

Cancel a Booking
DELETE  https://apitest.portconnect.co.nz/v1/bookings/0AKL005396/HSUD

Response

A return code of 204 indicates the subscription has been cancelled successfully.

Resources


Postman

To assist with testing, we have created a set of Postman collections and an environment file, contained in PortConnectAPIPostmanTests20190510.zip

Setting Up

To use the tests in Postman:

  • Download the zip file and extract the three collection files and the environment file.
  • Import the files into Postman.

You should now see the following tests visible in Postman:

Now enter your subscription key obtained from the developer portal, and you are good to go:




Rate Limit

Trial Subscription
Limited to 100 API calls to any end point within a 24 hour period.

Full Access Subscription
Limited to 120 calls to any endpoint within 60 seconds.

Overall cap of 10,000 calls in a 24 hour period.


Pricing

A free trial subscription is available for 3-months. To register interest in a trial or for a full access subscription, please contact PortConnect at info@portconnect.co.nz

Scheduled vessels

  • $0.05NZD per call if not subscribed to Track & Trace
  • Free for Subscribed Track & Trace users

Container Visits

  • $0.05NZD per container/per call (max 10 containers per call) when searching containers directly.

Container Event Subscriptions

  • $0.20NZD per event update (Notification) sent*
  • Includes 1 free callback to the container visit URL to retrieve standing container data (provided in the callback payload).
*High volume users may qualify for preferred customer discounts.


Terms & Conditions
Users must be subscribed to Track & Trace for all API services.


  • No labels