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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | { "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:
1 2 3 | { "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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | <?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", "Accept: application/vnd.printdeal-api.v2" ) )); $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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | <?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", "Accept: application/vnd.printdeal-api.v2" ) )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } |