Creating order

You can create an order by sending the order information in JSON as a POST request to /api/orders.

The following can be used as an example to create an order:

{
  "orderLines": [
    {
      "sku": "06fa88a1-18e3-42fc-bef7-21c0b2d44196",
      "attributes": [
        {
          "attribute": "format",
          "value": "A4"
        },
        {
          "attribute": "material",
          "value": "woodfree coated mat mc"
        },
        {
          "attribute": "weight",
          "value": "170 grs"
        },
        {
          "attribute": "printing colors",
          "value": "4/0 full color"
        },
        {
          "attribute": "printing process",
          "value": "full color offset"
        },
        {
          "attribute": "quantity",
          "value": "10000"
        },
        {
          "attribute": "delivery time",
          "value": "normal"
        },
        {
          "attribute": "finishing options",
          "value": "without luxury finishing"
        },
        {
          "attribute": "punchholes",
          "value": "2 punchholes"
        },
        {
          "attribute": "bundling",
          "value": "bundling per 250"
        }
      ],
      "files": [
        {
          "url": "https://s3-eu-west-1.amazonaws.com/printdealcdn/content_service/informatiesheet_cold-foil.pdf"
        }
      ]
    },
    {
      "sku": "dab96802-727c-4743-836d-8de5d8d7c60a",
      "attributes": [
        {
          "attribute": "printing process",
          "value": "unprinted"
        },
        {
          "attribute": "quantity",
          "value": "1"
        },
        {
          "attribute": "delivery time",
          "value": "normal"
        },
        {
          "attribute": "accessories",
          "value": "squeegee (rakel)"
        }
      ]
    }
  ],
  "invoiceAddress": {
    "company":"Bedrijfsnaam",
    "firstName":"Voornaam",
    "lastName":"Achternaam",
    "email":"Voornaam@gmail.com",
    "street": "Dorpsstraat",
    "housenumber": "123",
    "zipcode": "1234AB",
    "city": "Dorp",
    "country": "nl"
  },
  "deliveryAddress": {
    "company":"Bedrijfsnaam",
    "firstName":"Voornaam",
    "lastName":"Achternaam",
    "street": "Dorpsstraat",
    "housenumber": "123",
    "housenumberAddition": "A",
    "zipcode": "1234AB",
    "city": "Dorp",
    "country": "nl"
  },
  "deliveryMethod": 1,
  "reference": "reference-1234",
  "poNumber": "poNumber"
}

The response will be a JSON object with the order UUID that can be used to retrieve information from the order:

{
    "uuid": "fea079fc-2f77-4223-9d5f-10254bb48717"
}

Payment

The payment method for this order is on account. You will receive the invoice by email.

Required fields

Field

Type

Description

orderLines

Array

Array with orderlines

orderLines > productCode

String

The code of the requested product

orderLines > files

Array

Array with one file, due too technical limitations its currently not possible to supply multiple files per orderline

orderLines > files > url

String

URL of a PDF file.

invoiceAddress

Object

Object of the invoice address. See Addresses for more information.

deliveryAddress

Object

Object of the delivery address. See Addresses for more information.

deliveryMethod

Integer

ID of the delivery method. See Delivery methods for more information.

Optional fields

Field

Type

Description

reference

String

Your reference. Max length: 35 chars.

poNumber > productCode

String

Your purchase-order number. Max length: 120 chars.

orderLines > externalId

String

The external ID you want to pass

testOrder

Boolean

To place a test order true / false

Order has failed

The Printdeal API was updated at 21 December 2018 around 13:00, after this time, when an order creation failed and you retrieve the order, you now receive an 404 result, with an error message that the order creation has failed. Orders that failed before this date and time will have a 404 not found response.

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.printdeal.com/api/orders",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => '{
      "orderLines": [
        {
          "sku": "06fa88a1-18e3-42fc-bef7-21c0b2d44196",
          "attributes": [
            {
              "attribute": "format",
              "value": "A4"
            },
            {
              "attribute": "material",
              "value": "woodfree coated mat mc"
            },
            {
              "attribute": "weight",
              "value": "170 grs"
            },
            {
              "attribute": "printing colors",
              "value": "4/0 full color"
            },
            {
              "attribute": "printing process",
              "value": "full color offset"
            },
            {
              "attribute": "quantity",
              "value": "10000"
            },
            {
              "attribute": "delivery time",
              "value": "normal"
            },
            {
              "attribute": "finishing options",
              "value": "without luxury finishing"
            },
            {
              "attribute": "punchholes",
              "value": "2 punchholes"
            },
            {
              "attribute": "bundling",
              "value": "bundling per 250"
            }
          ],
          "files": [
            {
              "url": "https://s3-eu-west-1.amazonaws.com/printdealcdn/content_service/informatiesheet_cold-foil.pdf"
            }
          ]
        },
        {
          "sku": "dab96802-727c-4743-836d-8de5d8d7c60a",
          "attributes": [
            {
              "attribute": "printing process",
              "value": "unprinted"
            },
            {
              "attribute": "quantity",
              "value": "1"
            },
            {
              "attribute": "delivery time",
              "value": "normal"
            },
            {
              "attribute": "accessories",
              "value": "squeegee (rakel)"
            }
          ]
        }
      ],
      "invoiceAddress": {
        "company":"Bedrijfsnaam",
        "firstName":"Voornaam",
        "lastName":"Achternaam",
        "email":"Voornaam@gmail.com",
        "street": "Dorpsstraat",
        "housenumber": "123",
        "zipcode": "1234AB",
        "city": "Dorp",
        "country": "nl"
      },
      "deliveryAddress": {
        "company":"Bedrijfsnaam",
        "firstName":"Voornaam",
        "lastName":"Achternaam",
        "street": "Dorpsstraat",
        "housenumber": "123",
        "housenumberAddition": "A",
        "zipcode": "1234AB",
        "city": "Dorp",
        "country": "nl"
      },
      "deliveryMethod": 1,
      "reference": "reference-1234",
      "poNumber": "poNumber"
    }',
    CURLOPT_HTTPHEADER => array(
        "User-ID: YOUR_USER_ID_HERE",
        "API-Secret: YOUR_SECRET_HERE"
    )
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}

Example request create order

The following PHP code can be used to create an order. Make sure you replace the values YOUR_USER_ID_HERE and YOUR_SECRET_HERE with the User-ID and secret you received on the API-credentials page.

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.printdeal.com/api/orders",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => '{
      "orderLines": [
        {
          "sku": "06fa88a1-18e3-42fc-bef7-21c0b2d44196",
          "attributes": [
            {
              "attribute": "format",
              "value": "A4"
            },
            {
              "attribute": "material",
              "value": "woodfree coated mat mc"
            },
            {
              "attribute": "weight",
              "value": "170 grs"
            },
            {
              "attribute": "printing colors",
              "value": "4/0 full color"
            },
            {
              "attribute": "printing process",
              "value": "full color offset"
            },
            {
              "attribute": "quantity",
              "value": "10000"
            },
            {
              "attribute": "delivery time",
              "value": "normal"
            },
            {
              "attribute": "finishing options",
              "value": "without luxury finishing"
            },
            {
              "attribute": "punchholes",
              "value": "2 punchholes"
            },
            {
              "attribute": "bundling",
              "value": "bundling per 250"
            }
          ],
          "files": [
            {
              "url": "https://s3-eu-west-1.amazonaws.com/printdealcdn/content_service/informatiesheet_cold-foil.pdf"
            }
          ]
        },
        {
          "sku": "dab96802-727c-4743-836d-8de5d8d7c60a",
          "attributes": [
            {
              "attribute": "printing process",
              "value": "unprinted"
            },
            {
              "attribute": "quantity",
              "value": "1"
            },
            {
              "attribute": "delivery time",
              "value": "normal"
            },
            {
              "attribute": "accessories",
              "value": "squeegee (rakel)"
            }
          ]
        }
      ],
      "invoiceAddress": {
        "company":"Bedrijfsnaam",
        "firstName":"Voornaam",
        "lastName":"Achternaam",
        "email":"Voornaam@gmail.com",
        "street": "Dorpsstraat",
        "housenumber": "123",
        "zipcode": "1234AB",
        "city": "Dorp",
        "country": "nl"
      },
      "deliveryAddress": {
        "company":"Bedrijfsnaam",
        "firstName":"Voornaam",
        "lastName":"Achternaam",
        "street": "Dorpsstraat",
        "housenumber": "123",
        "housenumberAddition": "A",
        "zipcode": "1234AB",
        "city": "Dorp",
        "country": "nl"
      },
      "deliveryMethod": 1,
      "reference": "reference-1234",
      "poNumber": "poNumber"
    }',
    CURLOPT_HTTPHEADER => array(
        "User-ID: YOUR_USER_ID_HERE",
        "API-Secret: YOUR_SECRET_HERE"
    )
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}