Attribute/values from a category

To know which attributes and values are available from a category, you can send a GET request to /api/products/{sku}/attributes.

The response contains attributes where the values can be either:

  1. A List of Options: The attribute value is a list of strings that enumerate predefined options. These options represent fixed choices that can be selected.

  2. A Range Object: The attribute value is an object defining a range with properties:

    • minimum: The smallest allowable value in the range.

    • maximum: The largest allowable value in the range.

    • increment: The step value that defines the allowed increments between the minimum and maximum.

    • unitOfMeasure: A string specifying the unit associated with the range values (e.g., “mm”).

This will return a response similar to:

{
  "format": [
    "A4",
    "A5"
  ],
  "material": [
    "lasergeschikt bankpost wit",
    "lasergeschikt ECO",
    "lasergeschikt biotop natural FSC",
    "lasergeschikt vergé white",
    "lasergeschikt vergé naturel"
  ],
  "weight": [
    "80 grs",
    "120 grs"
  ],
  "printing colors": [
    "1/0 PMS",
    "4/0 full color",
    "3/3 PMS",
    "4/4 full color"
  ],
  "printing process": [
    "digital",
    "full color offset",
    "PMS colors"
  ],
  "quantity": [
    "25",
    "50",
    "250",
    "500",
    "1000",
    "5000",
    "10000",
    "15000",
    "100000",
    "variable quantity"
  ],
  "delivery time": [
    "normal",
    "express",
    "overnight"
  ],
  "letterheads punchholes": [
    "2 punchholes",
    "4 punchholes",
    "no punchhole"
  ],
  "bundling": [
    "no bundling",
    "bundling per 100",
    "bundling per 250"
  ],
  "Custom Height": [
    {
      "minimum": 10,
      "maximum": 287,
      "increment": 1,
      "unitOfMeasure": "mm"
    },
    {
      "minimum": 10,
      "maximum": 200,
      "increment": 1,
      "unitOfMeasure": "mm"
    }
  ],
  "Custom Width": [
    {
      "minimum": 10,
      "maximum": 287,
      "increment": 1,
      "unitOfMeasure": "mm"
    },
    {
      "minimum": 10,
      "maximum": 200,
      "increment": 1,
      "unitOfMeasure": "mm"
    }
  ]
}

To order a specific product you can retrieve the possible combinations, and create an order.

Example request

The following PHP code can be used to retrieve the available attributes and values. 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/products/0d1fce7e-245d-47fb-98bf-bea07f3ad16e/attributes",
  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"
  ),
));

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

curl_close($curl);

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

Dynamic Attributes

We have improved the functionality for “dynamic attributes” (we call them “externals”). Dynamic attributes are free input fields, for example, height & width for a banner, or a variable quantity. It is now possible to get them through the API. Each category has a fixed “externals” key. This key is always present, even if a category does not have externals. In this case, the value will be an empty array.

We also added validation rules for some of the externals. Not all rules are exported however, unfortunately our validation engine is too complex to show all the rules in a meaningful and understandable way. But basic rules like the minimum and maximum value for the externals “width”, “height”, and “quantity” are now exported in most cases. If you find externals without rules, than that means that either there are no rules defined, or the rule is too complex to show in the API. In this case, use trial and error to find valid products.

Criteria can also be present on external rules. These are values that must be present in the selection for this rule to be active. Take the following example below. The rule “width_max” (maximum width) with value “310” is active when “Budget PVC” is selected. But when “Flag fabric” is selected, the value for “width_max” is 5000.

{
  "material": [
    "Pvc frontlit",
    "Mesh",
    "Blockout",
    "Flag Fabric",
    "Budget Pvc"
  ],
  "printing colors": [
    "4/0 Full Color",
    "4/4 Full Color"
  ],
  "banners finishing": [
    "Perimetric Reinforcement With Grommets Every 30 Cm",
    "Perimetric Reinforcement With Grommets Every 50 Cm",
    "No Finishing",
    "Pole Pockets Top And Bottom Side (8 Cm)",
    "Pole Pockets Top And Bottom Side (5 Cm)",
    "Pole Pockets Left And Right Side (8 Cm)",
    "Pole Pockets Left And Right Side (5 Cm)",
    "Perimetric Reinforcement With Grommets In Every Corner",
    "Grommets Every 30 Cm, Without Perimetric Reinforcement",
    "Pole Pockets Blockout Top And Bottom Side",
    "Pole Pockets Blockout Left And Right Side"
  ],
  "format": [
    "Custom Sizes (10 Mm Bleed)",
    "Custom Sizes (25 Mm Bleed)"
  ],
  "quantity": [
    "1",
    "variable quantity"
  ],
  "delivery time": [
    "Normal",
    "express",
    "overnight"
  ],
  "printing process": [
    "Digital"
  ],
  "externals": {
    "width": [
      {
        "validation": "width_min",
        "value": "10",
        "criteria": [
          "Pvc frontlit",
          "Blockout",
          "Mesh",
          "Flag Fabric"
        ]
      },
      {
        "validation": "width_max",
        "value": "5000",
        "criteria": [
          "Pvc frontlit",
          "Mesh"
        ]
      },
      {
        "validation": "width_max",
        "value": "5000",
        "criteria": [
          "Flag Fabric"
        ]
      },
      {
        "validation": "width_min",
        "value": "10",
        "criteria": [
          "Budget Pvc"
        ]
      },
      {
        "validation": "width_max",
        "value": "310",
        "criteria": [
          "Budget Pvc"
        ]
      },
      {
        "validation": "width_min",
        "value": "30",
        "criteria": [
          "Pole Pockets Left And Right Side (8 Cm)"
        ]
      },
      {
        "validation": "width_max",
        "value": "1200",
        "criteria": [
          "Blockout"
        ]
      }
    ],
    "quantity": [
      {
        "validation": "quantity_min",
        "value": "1",
        "criteria": [
          "Normal",
          "express",
          "overnight"
        ]
      },
      {
        "validation": "quantity_max",
        "value": "50",
        "criteria": [
          "Normal",
          "express"
        ]
      },
      {
        "validation": "quantity_max",
        "value": "25",
        "criteria": [
          "overnight"
        ]
      }
    ],
    "height": [
      {
        "validation": "height_min",
        "value": "10",
        "criteria": [
          "Pvc frontlit",
          "Blockout",
          "Mesh",
          "Flag Fabric"
        ]
      },
      {
        "validation": "height_max",
        "value": "5000",
        "criteria": [
          "Pvc frontlit",
          "Mesh"
        ]
      },
      {
        "validation": "height_max",
        "value": "1000",
        "criteria": [
          "Flag Fabric",
          "Budget Pvc"
        ]
      },
      {
        "validation": "height_max",
        "value": "5000",
        "criteria": [
          "Flag Fabric"
        ]
      },
      {
        "validation": "height_min",
        "value": "10",
        "criteria": [
          "Budget Pvc"
        ]
      },
      {
        "validation": "height_max",
        "value": "1000",
        "criteria": [
          "Budget Pvc"
        ]
      },
      {
        "validation": "height_min",
        "value": "30",
        "criteria": [
          "Pole Pockets Top And Bottom Side (8 Cm)"
        ]
      },
      {
        "validation": "height_max",
        "value": "315",
        "criteria": [
          "Blockout"
        ]
      }
    ]
  }
}