Shipments

General

accessibleWithTrailer is currently required, but in the near future this property will become optional.
By adding ?withLabelPdfData to the URL the generated labels will be included in the response.

Example PostNL Standaard zending (NL)

Minimal example to create a PostNL Standaard zending

PHP SDK
<?php

require 'vendor/autoload.php';

const CLIENT_ID = '';
const CLIENT_SECRET = '';

$shipToContact = new \Boekuwzending\Resource\Contact();
$shipToContact->setName('Rik Balder');
$shipToContact->setCompany('Boekuwzending.com');
$shipToContact->setEmailAddress('info@boekuwzending.com');

$shipToAddress = new \Boekuwzending\Resource\Address();
$shipToAddress->setStreet('Bennebroekerweg');
$shipToAddress->setNumber('267');
$shipToAddress->setPostcode('1435CJ');
$shipToAddress->setCity('Rijsenhout');
$shipToAddress->setCountryCode('NL');

$dispatchInstruction = new \Boekuwzending\Resource\DispatchInstruction();
$dispatchInstruction->setEoriNumber('987162786');
$dispatchInstruction->setVatNumber('659183695');
$dispatchInstruction->setDate(new DateTime());

$item = new \Boekuwzending\Resource\Item();
$item->setType(\Boekuwzending\Resource\Item::TYPE_PACKAGE);
$item->setQuantity(1);
$item->setLength(10);
$item->setWidth(10);
$item->setHeight(10);
$item->setWeight(10);
$item->setDescription('Dog food');

$shipment = new \Boekuwzending\Resource\Shipment();
$shipment->setService('postnl-3085');
$shipment->setShipToContact($shipToContact);
$shipment->setShipToAddress($shipToAddress);
$shipment->setDispatch($dispatchInstruction);
$shipment->addItem($item);

$shipment->setTransportType(\Boekuwzending\Resource\Shipment::TRANSPORT_TYPE_ROAD);

$client = \Boekuwzending\ClientFactory::build(CLIENT_ID, CLIENT_SECRET);
$client->shipment->create($shipment);

# By adding `true` as the second parameter to the `create` method the generated labels will be included in the response.
Curl
ACCESS_TOKEN= # The Access Token from the token request

curl 'https://api.boekuwzending.com/shipments' \
--request POST \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--data-raw '{
    "service": "postnl-3085",
    "shipTo": {
        "contact": {
            "name": "Rik Balder",
            "company": "Boekuwzending.com",
            "emailAddress": "info@boekuwzending.com"
        },
        "address": {
            "street": "Bennebroekerweg",
            "number": "267",
            "postcode": "1435CJ",
            "city": "Rijsenhout",
            "country": "NL",
            "accessibleWithTrailer": false
        }
    },
    "items": [
        {
            "quantity": 1,
            "type": "package",
            "dimensions": {
                "length": 10,
                "width": 10,
                "height": 10
            },
            "weight": 10
        }
    ]
}'
JSON
{
    "service": "postnl-3085",
    "shipTo": {
        "contact": {
            "name": "Rik Balder",
            "company": "Boekuwzending.com",
            "emailAddress": "info@boekuwzending.com"
        },
        "address": {
            "street": "Bennebroekerweg",
            "number": "267",
            "postcode": "1435CJ",
            "city": "Rijsenhout",
            "country": "NL",
            "accessibleWithTrailer": false
        }
    },
    "items": [
        {
            "quantity": 1,
            "type": "package",
            "dimensions": {
                "length": 10,
                "width": 10,
                "height": 10
            },
            "weight": 10
        }
    ]
}

Example PostNL PickupPoint

Minimal example to create a PostNL Standaard Shipment to a PickupPoint

JSON
{
  "service": "postnl-3533",
  "shipTo": {
    "contact": {
      "name": "Rik Balder",
      "company": "Boekuwzending.com",
      "emailAddress": "info@boekuwzending.com"
    },
    "address": {
      "street": "Bennebroekerweg",
      "number": "267",
      "postcode": "1435CJ",
      "city": "Rijsenhout",
      "country": "NL",
      "accessibleWithTrailer": false
    }
  },
  "items": [
    {
      "quantity": 1,
      "type": "package",
      "dimensions": {
        "length": 10,
        "width": 10,
        "height": 10
      },
      "weight": 10
    }
  ],
  "pickupPoint": {
    "identifier": "postnl-162528",
    "distributorCode": "postnl",
    "name": "Spar",
    "country": "NL",
    "postcode": "2481AR",
    "city": "Woubrugge",
    "street": "Batehof",
    "number": "1"
  }
}

Example DPD Classic (GB)

Minimal example to create a DPD Classic shipment to Great Britain.

Item value and tariffNumber are mandatory for international shipments outside the EU.
For shipments to Great Britain the EORI-number for the sender (dispatch) and receiver (delivery) are required.
JSON
{
    "service": "buz-dpd-classic",
    "shipTo": {
        "contact": {
            "name": "Example",
            "emailAddress": "info@boekuwzending.com",
            "phoneNumber": "+44-3447369000",
            "company": "H&M Oxford Circus"
        },
        "address": {
            "number": "261-271",
            "street": "Regent Street",
            "postcode": "W1B 2ES",
            "city": "London",
            "country": "GB",
            "accessibleWithTrailer": false
        }
    },
    "items": [
        {
            "quantity": 1,
            "type": "package",
            "dimensions": {
                "length": 25,
                "height": 20,
                "width": 40
            },
            "weight": 1.5,
            "description": "Pakket",
            "value": 250,
            "tariffNumber": "00640411"
        }
    ],
    "dispatch": {
        "eoriNumber": "ABC123123123"
    },
    "delivery": {
        "eoriNumber": "ABC123123123"
    }
}

For an overview of available services see Available services