Product combinations¶
To know which combinations are available for each category, you can send a GET
request to /api/products/{sku}/combinations
.
This will give you a response like:
v2
:
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 | [{ "product": { "attributes": [{ "attribute": "Delivery Type", "value": "Express" }, { "attribute": "Printing Process", "value": "Full Color Rotary Print" }, { "attribute": "Finishing Newspapers", "value": "Folded / Saddlestitched Pages" }, { "attribute": "Material", "value": "Woodfree Offset" }, { "attribute": "Number Of Pages", "value": "48 Pages" }], "prices": [{ "quantity": 1, "price": 0, "information": { "deliveryDays": 26 } }] } }, { "product": { "attributes": [{ "attribute": "Delivery Type", "value": "Express" }, { "attribute": "Printing Process", "value": "Full Color Rotary Print" }, { "attribute": "Finishing Newspapers", "value": "Folded / Saddlestitched Pages" }, { "attribute": "Material", "value": "Newsprint" }, { "attribute": "Number Of Pages", "value": "48 Pages" }], "prices": [{ "quantity": 1, "price": 0, "information": { "deliveryDays": 26 } }] } }] |
v1
:
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 | [ { "product": { "information": { "deliveryDays": "7" }, "attributes": [ { "attribute": "printing colors", "value": "1\/0 PMS" }, { "attribute": "quantity", "value": "250" }, { "attribute": "delivery time", "value": "normal" }, { "attribute": "colour options", "value": "light blue" }, { "attribute": "printing process", "value": "screenprint transfer" }, { "attribute": "type of cap", "value": "cap basic" } ], "price": 452.5 } }, { "product": { "information": { "deliveryDays": "7" }, "attributes": [ { "attribute": "printing colors", "value": "1\/0 PMS" }, { "attribute": "quantity", "value": "250" }, { "attribute": "delivery time", "value": "normal" }, { "attribute": "colour options", "value": "white" }, { "attribute": "printing process", "value": "screenprint transfer" }, { "attribute": "type of cap", "value": "cap basic" } ], "price": 452.5 } }, { "product": { "information": { "deliveryDays": "7" }, "attributes": [ { "attribute": "printing colors", "value": "1\/0 PMS" }, { "attribute": "quantity", "value": "250" }, { "attribute": "delivery time", "value": "normal" }, { "attribute": "colour options", "value": "red" }, { "attribute": "printing process", "value": "screenprint transfer" }, { "attribute": "type of cap", "value": "cap basic" } ], "price": 452.5 } } ] |
The attribute and values in product
can be used to create your order. The pricing is our default price, excluding any discounts.
If you receive an empty response, the category contains free input. You need to provide values for e.g. width and height yourself. The available attributes and values endpoint can provide you more information.
Note: The response can vary from a few kilobytes to a few megabytes, and for a few exceptions more than 100 megabyte. Make sure you store this information to prevent having to retrieve this information for every request.
Example request¶
The following PHP code can be used to retrieve the possible combinations of a category. 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 | <?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.printdeal.com/api/products/0d1fce7e-245d-47fb-98bf-bea07f3ad16e/combinations", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( "API-Secret: YOUR_SECRET_HERE", "User-ID: YOUR_USER_ID_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; } |