Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
hiddentrue

POST /v2/subscriptions

Insert excerpt
PUG:Container Event SubscriptionsPUG:
Container Event Subscriptions
nameCreating a Subscription
nopaneltrue

...

Code Block
POST https://api.portconnect.io/v2/subscriptions

Request Body

...

  • subscriptionData: The object defining the events being subscribed to.

Example Request:

Create a new container event subscription.

Code Block
POST https://api.portconnect.io/v2/subscriptions

Example Request Body

...

with Container Numbers

Code Block
{
  "containers": [
    { "containerNumber": "MEDU3085895", "userDefinedReference" : "User ref 1"},
    { "containerNumber": "APHU6303593", "userDefinedReference" : "User ref 2"},
    { "containerNumber": "MEDU5129708", "userDefinedReference" : "User ref 3"}
  ],
  "webhookURI": "https://enb8apr7yansapi.xyourcompany.pipedream.netco.nz/webhooks/portconnect", // Optional if emailAddressList is present
  "webhookToken": "123-456-789-000yoursecret", // Optional if emailAddressList is present
  "emailAddressList": ["me@test.com"], // Optional if webhookURI and webhookToken isare present
  "portCode": "NZTRG",
  "category": "IMPORT",
  "eventTypeCode": ["ALL", "Discharge"],
  "facilityCode": null
}

 

Response Body with containers:

Code Block
{
    "subscriptionId": 32,
    "containers": [
        {
            "expirationDatetime": "2023-06-20T14:50:30.3+12:00",
            "containerNumber": "TCNU8050683",
            "userDefinedReference" : "Azure Test 2"
        }
    ]
}

...

 

Request example using Booking Numbers

Request Body with Container Numbers

Code Block
{
  "bookings": [
    { "subscriptionIdbookingNumber": 162"MEDU3085895", "userDefinedReference" : "User ref "containers": [
   1"},
    { "bookingNumber": "APHU6303593", "userDefinedReference" : "User ref 2"},
    { "bookingNumber": "MEDU5129708", "userDefinedReference" : "User ref 3"}
  ],
  "expirationDatetimewebhookURI": "2023-06-23T11:21:49.1+12:00",https://api.yourcompany.co.nz/webhooks/portconnect", // Optional if emailAddressList is present
  "webhookToken": "yoursecret", // Optional if emailAddressList is present
  "emailAddressList": ["me@test.com"], // Optional if webhookURI and webhookToken are present
  "portCode": "NZTRG",
  "category": "IMPORT",
  "eventTypeCode": ["ALL", "Discharge"],
  "facilityCode": null
}

 

Response Body with bookings:

Code Block
{
    "subscriptionId": 32,
    "bookings": [
        {
            "subscriptionContainerIdexpirationDatetime": 679"2023-06-20T14:50:30.3+12:00",
            "containerNumberbookingNumber": "FSCU8191670TCNU8050683",
            "userDefinedReference": "LFTAzure ISOTest code2"
        }
    ]
}

Add label