API Developer's Guide

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, Timaru Container Terminal and Lyttelton Port Company.  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.

  • Vessel Schedule Event Subscriptions: Receive real-time alerts for key vessel information, including vessels omitting.

  • Container Visits: 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.

  • Export Pre-Advice: Submit export container details to Ports of Auckland and Port of Tauranga to gate-in.

  • Shipping Line Endpoints: PortConnect offers the following end points exclusively for the use of shipping lines.


Signing Up

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.  

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.

Once you sign up for the Trial, the free 3-month trial will commence.

If you sign-up for the Full Access, charges will apply. Please refer to our Pricing page.

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.


Rate Limit

Trial Subscription

Limited to 120 calls to any endpoint within 60 seconds and 100 API calls to any end point within a 24 hour period.

Full Access Subscription

Limited to 600 calls to any endpoint within 60 seconds. Overall cap of 20,000 calls in a 24 hour period.


Pricing

Please refer to our Pricing page.

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

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


Developer Portal

The Developer Portal is a useful tool that provides documentation for end points and auto-generated definitions for API object models. It also includes a test function that allows you to test API calls against our live data.

The PortConnect API endpoint to use from your client application is https://api.portconnect.io.  The developer portal can generate sample code in a number of different programming languages:

 

 

 

Feel free to use other API tools such as Postman.  See the resources section below for some Postman tests you can use.


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 our new Vessel Schedule Event Subscription end point for details on how to be notified when vessel events such as cancellations and changes in arrival times occur.

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

Request

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=2022-05-02&arrivalDateTo=2022-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=2022-05-02T13:00:00&arrivalDateTo=2022-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": "PIS084N", "vesselName": "CAPITAINE TASMAN", "imoNumber": 9354533, "inboundVoyage": "083S", "alternativeInboundVoyage": null, "outboundVoyage": "084N", "alternativeOutboundVoyage": "083S, 084", "vesselStatus": "EXPECTED", "vesselType": "COMMERCIAL", "portCode": "NZTRG", "wharfName": "TAURANGA", "previousPortName": "LAUTOKA", "nextPortName": "SYDNEY", "vesselOperator": "NPDL", "serviceCode": "NEP", "arrivalDatetime": "2023-04-22T02:15:00+12:00", "departureDatetime": "2023-04-22T15:00:00+12:00", "receivalCommenceInland": "2023-04-13T08:00:00+12:00", "receivalCommenceSeaport": "2023-04-14T20:00:00+12:00", "receivalCutoffInland": "2023-04-19T08:00:00+12:00", "rcvCommReeferinland": "2023-04-15T00:01:00+12:00", "rcvCommHazinland": "2023-04-17T22:15:00+12:00", "rcvCutoffHazinland": null, "rcvCommReeferSeaport": "2023-04-15T00:01:00+12:00", "rcvCommHazSeaport": "2023-04-20T02:15:00+12:00", "rcvCutoffHazSeaport": null, "receivalCutoffSeaport": "2023-04-20T15:00:00+12:00", "lastUpdatedDateTime": "2023-04-21T10:14:53.02+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. 

Request

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

Response

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

Example response

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:


Container Event Subscriptions

Use container event subscriptions, or "subscriptions", when you want PortConnect to send you an http (“webhook”) 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 a request the subscriptions endpoint. Version 1 requests a single container visit event type code per request, Version 2 supports multiple container visit event type codes in a single request. Version 2 also supports the use of “ALL” to subscribe to all events for one or more containers.

Callbacks can be sent as emails to multiple email addresses, or as HTTP requests.

Version 1

Each subscription relates to a single event type, however multiple containers can be included. 

For version 1, a new subscription is created for every unique combination of PortCodeCategoryEventTypeCode and FacilityCode . If a subscription already exists for a particular combination then:

  • containers are added to that subscription

  • the emails are replaced

You must pass either WebhookURI and WebhookToken or an EmailAddressList to create a subscription. Both are not required

Subscription V1 Create Example

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

Version 2

Version 2 of the subscription API supports multiple container event types, as well as the of “ALL” to subscribe to all possible events. Event type codes are supplied as an array.

For version 2, a new subscription is created for every unique combination of PortCodeCategory and FacilityCode .  If a subscription already exists for a particular combination, then containers are added to that subscription.

You must pass either WebhookURI and WebhookToken or an EmailAddressList to create a subscription. Both are not required.

For the eventTypeCodes we allow for more than 10 event types to be specified in the subscription request. Previously only up to 10 event types could be supplied or "ALL".

Subscription V2 Create Example

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. Other rules common to both versions are:

  • Valid port codes are: NZAKLNZTRG, NZTIU or NZLYT

  • Valid category codes are: IMPORTEXPORTTRANSHIPMENTDOMESTIC

  • 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 Notification Types.

  • You can provide an unlimited number of containers in each subscription request.

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.


Event 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 Port Codes

Supported Facility Codes

Event Value 1

Event Value 2

Code

Description

Supported Port Codes

Supported Facility Codes

Event Value 1

Event Value 2

ACTIVE

Container record becomes live in PortConnect system

NZAKL, NZTRG, NZTIU, NZLYT

NZMKL, NZRUA





AVAILABLE

Availability Advice (Container is discharged and fully released)

NZAKL, NZTRG, NZTIU, NZLYT

NZMKL, NZRUA





AVAILABLECANCELLED

Availability Advice cancelled

NZAKL, NZTRG, NZTIU, NZLYT

 





BOOKINGDISCREPANCY

Discrepancy: Booking does not match Preadvise/Gate-in details

NZAKL, NZTRG, NZTIU, NZLYT

 

Container Visit value

Booking value

CLEARED

Cleared Advice (Container is fully cleared)

NZAKL, NZTRG, NZTIU, NZLYT

 





CEDORELEASE

CEDO Release

NZAKL, NZTRG, NZTIU, NZLYT

 

 

 

CEDOREVOKED

CEDO Revokes

NZAKL, NZTRG, NZTIU, NZLYT

 

 

 

CLEAREDCANCELLED

Cleared Advice cancelled

NZAKL, NZTRG, NZTIU, NZLYT

 





CUSTOMSRELEASE

Notice of Customs Release

NZAKL, NZTRG, NZTIU, NZLYT

NZMKL, NZOLT,
NZRUA





CUSTOMSRELEASECANCELLED

Notice of Customs Release cancelled

NZAKL, NZTRG, NZTIU, NZLYT

 





DEPART

Facility Departure Advice

NZAKL

NZWII





DISCHARGE

Discharge Advice

NZAKL, NZTRG, NZTIU, NZLYT

 





EXPORTCLEARED

CEDO is in place and there are no other stops

NZAKL, NZTRG, NZTIU, NZLYT

 





EXPORTCLEAREDCANCELLED

Export Cleared cancelled

NZAKL, NZTRG, NZTIU, NZLYT

 





GATEIN

Gate IN advice

NZAKL, NZTRG, NZTIU, NZLYT

NZMKL, NZWII, NZOLT, NZCHC,
NZRUA

Mode of transport, eg. Road

Identifier for the truck or train, eg. REL328

GATEOUT

Gate OUT Advice

NZAKL, NZTRG, NZTIU, NZLYT

NZMKL, NZWII, NZOLT, NZCHC,
NZRUA

Mode of transport, eg. Road

Identifier for the truck or train, eg. REL328

HAZARDGATERULE

Hazardous Cargo Gate-in rule applies

NZAKL, NZTRG, NZTIU, NZLYT

 





LFT24HOURS

Container visit Last Free Time within 24 hours

NZAKL, NZTRG, NZTIU

NZMKL,
NZRUA

Last free time

 

LFTCHANGED

Container visit Last Free Time has been changed

NZAKL, NZTRG, NZTIU

NZMKL,
NZRUA

New last free time

Old Last free time value

LFTEXCEEDED

Container visit Last Free Time exceeded

NZAKL, NZTRG, NZTIU

NZMKL,
NZRUA

Last free time



LOAD

Notice of item loaded to Vessel

NZAKL, NZTRG, NZTIU, NZLYT

 





LOPRELEASE

Notice of Line Operator Release

NZAKL, NZMKL, NZTRG, NZTIU, NZLYT

NZMKL, NZOLT, NZCHC,
NZRUA





LOPRELEASECANCELLED

Notice of Line Operator Release - cancelled

NZAKL, NZTRG, NZTIU,  NZLYT

NZMKL, NZOLT, NZCHC,
NZRUA





MPIRELEASE

Notice of MPI Release

NZAKL, NZTRG, NZTIU, NZLYT

NZMKL, NZOLT, NZCHC,
NZRUA





MPIRELEASECANCELLED

Notice of MPI Release - cancelled

NZAKL, NZTRG, NZTIU, NZLYT

NZMKL, NZOLT, NZCHC,
NZRUA





NOCEDO

No Cedo Warning

NZAKL, NZTRG, NZTIU, NZLYT

 

48, 24, 2 hour warning text



PINAVAILABLE

ExpressPin Available

NZAKL

 

Express Pin number



PINSUSPENDED

ExpressPin Suspended

NZAKL

 

Express Pin number



VESSELARRIVAL

Vessel Visit Actual Time of Arrival

NZAKL, NZTRG, NZTIU, NZLYT

 





VESSELDEPARTURE

Vessel Visit Actual Time of Departure

NZAKL, NZTRG, NZTIU, NZLYT

 





PRIORITYGATEIN

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

NZTRG

 






Facility codes

  • NZMKL - MetroPort Auckland

  • NZCWF - Crawford Street, Hamilton

  • NZWII - Wiri, Ports of Auckland South Auckland Freight Hub

  • NZOLT - MetroPort Rolleston

  • NZCHC - CityDepot

  • NZRUA - Ruakura Freight Hub

Port Codes

  • NZTIU - Timaru Container Terminal

  • NZTRG - Port of Tauranga, Sulphur Point

  • NZAKL - Ports of Auckland 

  • NZLYT - Lyttelton Port Company

 

Response

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

Subscription Create Response (V1 and V2)

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:

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 invoking a GET action on the subscriptions end point with no parameters:

Subscription V1 GET All Example

Subscription V1 GET All Response

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

Subscription V2 GET All Example

Subscription V2 GET All Response

The subscription V2 response returns an array of subscribed event type codes in the response.

Searching for a Single Subscription

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

Subscription V1 Single GET Example

The following example returns the subscription details for subscription 9:

Subscription V1 Single GET Response

The response payload lists the matching subscription, for example:

Subscription Search

Subscription V2 Single GET Example

The following example returns the subscription details for subscription 1397:

Subscription V2 Single GET Response

The response payload lists the matching subscription, for example:

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 35 can be updated to include containers:

Subscription V1 Update
Subscription V2 Update

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, specifying the subscription to delete as a parameter in the URI.

Delete works the same for both versions of the subscription end point.

Subscription Delete

Response

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


Export Pre-Advice

Use the Export Pre-Advice end point to submit, retrieve and delete export pre-advice programmatically on behalf of a PortConnect user. Contact our User Support to be granted access to this end point.  PortConnect will associate an API user id with a specific PortConnect user so that export pre-advice can be submitted on behalf of that user.

Only the Ports of Auckland and the Port of Tauranga support Export Pre-advice submitted via PortConnect.

Submitting an Export Pre-advice

In order to understand the Export Pre-advice submission, some familiarity with the Export Pre-advice User Guide is recommended. This details how export pre-advice submitted via the PortConnect website. The structure of the API is conceptually very similar to this screen, comprising a header with a list of containers being submitted.

Example

This is a basic example of an export pre-advice message comprising the header with a single container record.  Additional properties allow the submission of refrigeration, vent, hazardous and over gauge settings, and these are detailed in the developer test portal.

Export pre-advice submit

Response

A return code of 201 Createdresults when the export pre-advice request is submitted. Importantly, the response payload needs to be examined to determine if both the overall export pre-advice was created successfully, along with the associated container records.  For instance the above request will return success flags at the header and the container level:

Export pre-advice success

However, should the requiredTemperature value be set to -50 in the example above, then the following is returned:

Export pre-advice partial failure


Validation

Validation of the export pre-advice request is extensive. Validation messages are generated at the PortConnect API level and also from the partner port, such as the example above. Validation message include:

  • Must provide a valid booking

  • Load Port must match the booking

  • Load Port must be valid

  • Line Operator code must be valid

  • Line Operator code must match the booking

  • Vessel Visit must match the booking

  • Discharge Port must match the booking

  • Reefer ISO type containers must have a Temperature (unless specified as a Non-Operating Reefer)

  • Freight Kind (Full vs Empty) must match the booking

  • Reefer temperatures must match the booking

  • Conditioning details must match the booking. Conditioning details include: Humidity %, Vent value, Vent Type, O2% and CO2%

  • Hazard UN Codes must match the booking

  • Total Pre-Advised Containers must not exceed the booking quanta (count)

  • Seal Type must be valid

Email Notifications

Common to the export pre-advice screen and B2B export pre-advice functions, the export pre-advice api supports the use of email notifications. By specifying one or more email addresses in the notificationEmails property, an email is generated which confirms which containers are successfully pre-advised. This is an optional property.

The emails contain two boxes, a green box in which successful containers will display and a red box in which unsuccessful containers will display. Containers in the green box show all the key details of the container. You can use this email to share the details with other parties. Any unsuccessful containers will show in the red box with a comment about why the Pre-Advice was not successful. The same message also appears on the PortConnect website.

Other Notes

Subsequent calls using the same header information will update the container list, overwriting the previous container list with the new values.

Calls made via the API are reflected in the PortConnect Export Pre-advice screen.  For instance, if containers are added or removed, then this will be reflected on the Export Pre-Advice screen.  PortConnect also has the capability to generate an API call from the Export Pre-advice screen, which is useful for more complex scenarios.  Contact user support to find out more about this.

Codes to use for various properties are listed on this page.

Retrieving an Export Pre-Advice

An export pre-advice can be retrieved using a GET to the export-preadvices end point, specifying the port and user reference in the URL,  and optionally a container number.  Specifying the container number restricts the response to only the export pre-advice header and the container number.

Example

The following example returns all information relating to the export pre-advice submitted above.

Export pre-advice retrieve


Validation

If an incorrect partner port code is used then a 400 Bad Request response is returned.

If the user reference is not found then a 404 Not Found response is returned.

Response

The response is the same format as the post request, with the addition of the status of the latest submission.  For example:

Export pre-advice response


Cancelling an Export Pre-Advice

This operation cancels one or more containers in an export pre-advice. The export pre-advice is identified through the combination of a partner port code and a user reference.

Example

Containers to be cancelled from an export pre-advice are specified in the request payload of the delete action, as in this example.

Validation

Response

Success will result in a return code of 204 No Content.

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


Vessel Schedule Event Subscriptions

Use Vessel Schedule Event subscriptions when you want PortConnect to send you an http (“webhook”) callback when any vessel schedule event occurs. Vessel Schedule Event Subscriptions work in a more simplified way to compared to the Container Visit Event Subscription end point.

Subscription Create Example

For example, the following request will result in a webhook callback when any vessel related events occur at the Port of Tauranga.

Optionally, specific vessels can be included in the payload if desired. Vessels are identified by the port vessel reference or by the Lloyd/IMO number of the vessel.

For the eventTypeCodes you can create a subscription for

  • specific event e.g. VesselCancelled

  • multiple

  • “ALL”

Single eventTypeCode

Multiple eventTypeCodes

All eventTypeCodes

Finally, you can specify just one port and get callbacks without filtering by wharftype

Just like container visit subscriptions there is the option to have the callbacks as emails as shown below.

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. Other rules are:

  • Valid port codes are: NZAKLNZTRG, NZTIU or NZLYT

  • Valid wharf types are Terminal or MultiCargo

  • Vessel schedule subscriptions are unique for the combination of API user, port code and wharf type

  • Sending a new array of vessels will replace the existing array.

Event Notification Types

Any or all of the following events may be sent in relation to a subscription.

Event Code

Event Description

Notes

Event Code

Event Description

Notes

VesselArrival

Vessel Arrival

  • No time limit for when the event can be sent.

  • Arrival date time is provided.

VesselETAChanged

Vessel ETA Changed

  • If the current time is more than 6 hours prior to the ETA changed time a Notification will be sent

  • Arrival Date has to be in the next 31 days.

  • The Notification will not be sent if the vessel has already arrived.

VesselDeparture

Vessel Departure

  • No time limit for when the event can be sent.

  • Departure date time is provided.

VesselETDChanged

Vessel ETD Changed

  • If the current time is more than 6 hours prior to the ETD changed time a Notification will be sent.

  • Arrival Date has to be in the next 31 days.

  • The Notification will not be sent if the vessel has already departed.

ReceivalCommenceInlandChanged

Receival Commence Inland Changed

  • If the current time is more than 6 hours prior to the ETA changed time a Notification will be sent

  • Arrival Date has to be in the next 31 days.

  • If the vessel has departed, no Notification will be sent.

ReceivalCutOffInlandChanged

Receival Cut Off Inland Changed

  • If the current time is more than 6 hours prior to the ETA changed time a Notification will be sent

  • Arrival Date has to be in the next 31 days.

  • If the vessel has departed, no Notification will be sent.

ReceivalCommenceSeaportChanged

Receival Commence Seaport Changed

  • If the current time is more than 6 hours prior to the ETA changed time a Notification will be sent

  • Arrival Date has to be in the next 31 days.

  • If the vessel has departed, no Notification will be sent.

ReceivalCutOffSeaportChanged

Receival Cut Off Seaport Changed

  • If the current time is more than 6 hours prior to the ETA changed time a Notification will be sent

  • Arrival Date has to be in the next 31 days.

  • If the vessel has departed, no Notification will be sent.

VesselCancelled

Vessel Cancelled

  • Inactive (when vessel visit isn't supplied by the partner port in vessel schedule file).

  • No time limit for when the event can be sent.

Subscription Create Response

Success will result in a return code of 201 Created. The response to the request will return a subscription id that can be used in subsequent patch or delete calls if desired.

Subscription Create Response With Vessel References

Webhook Callback Payload

One or more events will be sent to the specified web hook in an array.

Example Callback Email

Emails are sent with a table containing the most valuable data from the event, and an attachment containing the JSON payload of all the details.

 

Logic for Vessel Schedule Events

  • When PortConnect receive an update from the partner port, we will only generate another event if the previous raised event Arrival Dttm or Departure Dttm is different to the new file.

  • 6 hour time limit for Notifications: E.g. It is currently 11.59am, Vessel ETD is set to 6pm so a Notification will be sent. If the time was 12.30pm a Notification would not be sent.

Deleting Subscriptions

Subscriptions may be deleted by sending a delete request with an empty request body to the subscriptions end point, specifying the subscription to delete as a parameter in the URI.

Subscription Delete

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

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

Validation

The following validation rules apply:

  • partnerPortCode must be one of NZAKL, NZTRG, NZTIU or NZLYT

  • 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

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

Response

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


Error Responses

We don’t provide any retries or error handling, please see below the response codes for troubleshooting.

HTTP response code

 

HTTP response code

 

201 OK

The request succeeded. The result meaning of "success" depends on the HTTP method.

201 Created

The request succeeded, and a new resource was created as a result. This is typically the response sent after POST requests.

400 Bad request

The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

401 Unauthorized

This response means "unauthenticated". That is, the client must authenticate itself to get the requested response.

403 Forbidden

The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource.

404 Not Found

The server cannot find the requested resource, likely due to incorrect container number or port code in the request.

500 Internal Server Error

The server has encountered a situation it does not know how to handle.


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:

 


© PortConnect 2023