Validate product and retrieve price

To make sure you have an order-able product, you can validate the attributes and values. Send the attributes and values in a POST request to /api/products/{sku}.

If you can order your product, you will receive the following data: price and promised arrival date

Small note, the delivery days are working days, so holidays and weekends needs to be added to get the actual date.

If the product is invalid, you will retrieve a 400 status code.

Request example

 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
{
    "attributes": [
        {
            "attribute": "format",
            "value": "A4"
        },
        {
            "attribute": "material",
            "value": "lasergeschikt bankpost wit"
        },
        {
            "attribute": "weight",
            "value": "80 grs"
        },
        {
            "attribute": "printing colors",
            "value": "1/0 PMS"
        },
        {
            "attribute": "printing process",
            "value": "PMS colors"
        },
        {
            "attribute": "quantity",
            "value": "500"
        },
        {
            "attribute": "delivery time",
            "value": "normal"
        },
        {
            "attribute": "letterheads punchholes",
            "value": "2 punchholes"
        },
        {
            "attribute": "bundling",
            "value": "no bundling"
        }
    ]
}

Response example

1
2
3
4
5
6
7
{
    "price": 99.9,
    "deliveryDays": 0,
    "planoWidth": 0,
    "planoHeight": 0,
    "promisedArrivalDate": "2030-12-12"
}
Field Type Description
price float Price of the product
deliveryDays Int Deprecated, returns 0 in v2 for backwards compatibility.
planoWidth Int Deprecated, returns 0 in v2 for backwards compatibility.
planoHeight Int Deprecated, returns 0 in v2 for backwards compatibility.
promisedArrivalDate String|Null Date in the format yyyy-mm-dd. If value returns NULL there went something wrong with calculating the date.

Example request

The following PHP code can be used to validate a product and receive the price. 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
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.printdeal.com/api/products/17cba119-9f75-44e2-b410-d79b42468b35",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{
	"attributes": [
		{
			"attribute": "format",
			"value": "A4"
		},
		{
			"attribute": "material",
			"value": "lasergeschikt bankpost wit"
		},
		{
			"attribute": "weight",
			"value": "80 grs"
		},
		{
			"attribute": "printing colors",
			"value": "1/0 PMS"
		},
		{
			"attribute": "printing process",
			"value": "PMS colors"
		},
		{
			"attribute": "quantity",
			"value": "500"
		},
		{
			"attribute": "delivery time",
			"value": "normal"
		},
		{
			"attribute": "letterheads punchholes",
			"value": "2 punchholes"
		},
		{
			"attribute": "bundling",
			"value": "no bundling"
		}
	]
}',
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "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;
}