# Recipes

# Sample Data

A sample recipe for the demo watch product can be found at: https://cz.drrv.co/recipe/2-vBYtsQB2ndCosDcB.json

# Machine Readable

The primary recipe is stored as machine-readable JSON data file, at a well-defined location which can be generated by concatenating https://cz.drrv.co/recipe/ URL with the recipe ID and .json extension.

# Notable Recipe Components

Element
id A unique recipe ID.
created Timestamp when the recipe was generated.
name Product name.
styleCode Product ID.
humanReadable A link to the human-readable version of the recipe.
components A list of placements with a reference to the selected component for each placement.
views Product views with rendered product image references.
{
  "views": [
    {
      "name": "360°",
      "code": "360",
      "preview": "//img1.cohimg.net/is/image/DriveCommerce/?layer=0&scl=1&origin=0,0&src=DriveCommerce/W-SHADOW-28&layer=1&src=DriveCommerce/W-P01-SS-GD-28&origin=0,0&layer=2&src=DriveCommerce/W-P02-LE-BL-28&origin=0,0&fmt=png-alpha&.e=customizer&1",
      "previewPng": "//cz.drrv.co/recipe/2-vBYtsQB2ndCosDcB-360.png",
      "previewJpg": "//cz.drrv.co/recipe/2-vBYtsQB2ndCosDcB-360.jpg"
    },
    {
      "name": "Back",
      "code": "Back",
      "preview": "//img1.cohimg.net/is/image/DriveCommerce/?layer=0&scl=1&origin=0,0&src=DriveCommerce/W-SHADOW-16&layer=1&src=DriveCommerce/W-P01-SS-GD-16&origin=0,0&layer=2&src=DriveCommerce/W-P02-LE-BL-16&origin=0,0&fmt=png-alpha&.e=customizer&1",
      "previewPng": "//cz.drrv.co/recipe/2-vBYtsQB2ndCosDcB-Back.png",
      "previewJpg": "//cz.drrv.co/recipe/2-vBYtsQB2ndCosDcB-Back.jpg"
    },
    {
      "name": "Personalize",
      "code": "Personalize",
      "preview": "//img1.cohimg.net/is/image/DriveCommerce/?layer=0&scl=1&origin=0,0&src=DriveCommerce/W-SHADOW-40&anchor=0,0&layer=1&textPs={\\fonttbl{\\f1Arial;}}\\f1{\\iscolortbl;FFFFFF;}\\cf1\\fs120\\qc\\kerning1 TES&origin=0,0&size=200,200&pos=412,482&layer=2&src=DriveCommerce/W-P01-SS-GD-40&origin=0,0&layer=3&src=DriveCommerce/W-P02-LE-BL-40&origin=0,0&fmt=png-alpha&.e=customizer&1",
      "previewPng": "//cz.drrv.co/recipe/2-vBYtsQB2ndCosDcB-Personalize.png",
      "previewJpg": "//cz.drrv.co/recipe/2-vBYtsQB2ndCosDcB-Personalize.jpg"
    }
  ]
}

# Images and Image Views

One useful aspect of machine-readable recipes are images that could be used for presenting configured products in UX such as cart or checkout. These images can be found under views element, with one image generated for each configured product view. Customizer backend uploads a transparent PNG file and opaque optimized JPG image.

Keys
name View name.
code View code.
previewPng PNG version of the view image. Allows for transparency if source images also had transparent areas.
previewJpg JPEG version of the view image.

# Human Readable

In addition to the machine-readable JSON file, Customizer products a human-readable version of recipes in PDF format. These can be found at a well-defined location which can be generated by concatenating http://cz.drrv.co/recipe/ URL with the recipe ID and .pdf extension.

For example: https://cz.drrv.co/recipe/2-vBYtsQB2ndCosDcB.pdf

PDF describes the same Bill of Materials as the machine-readable format and includes rendered images of configured products.

# Creating a Recipe and Recipe API

Recipes are usually created by using one of Customizer JavaScript components. This ensures the recipe validity, i.e. that all placement have an option selected, options are purchasable, etc.

However, if there is a need to generate a recipe manually, this can be done by sending a POST request with a fully-configured recipe JSON the respective blueprint URL.

Last updated: 2/10/2021, 7:42:26 AM