The Pack is the main construct that API clients will deal with. It describes all the customer data required to create their printed product. The diagram below shows the basic relationships between the various different objects within the Pack object model:

As our new design canvas is using the API, we have developed a GreaseMonkey script to add a "Show API JSON" button to Canvas display page (/create/design.php). First, make sure you have GreaseMonkey installed, and then install the user script. You can then begin any product (e.g. Business Cards) and you can start inspecting the Pack data provided by clicking the "Show API JSON button"
The pack object is the container for the pack data model. A populated pack object can be passed to the moo.pack.createPack and moo.pack.updatePack methods and is returned from the moo.pack.getPack method. The Pack object has the following properties:
"pack":{
"numCards":50,
"productCode":"businesscard",
"productVersion":1,
"sides":[
]
}
The sides array is a unordered list of Side objects. Each Side describes content of an abstract side for use on physical cards. The sides in array are abstract in as much as they are not attributed to a physical side of a card. The attribution of sides to card sides is described below in the cards array. Each side specifies the template to be used, along with all the Pack user data items to be merged with the Template definition. This is modelled as the user data providing a set of overrides on top of the template definition (unless the Template specifies constraints on what can be overridden within the user data).
Each Side object has the following properties:
"sides":[
{
"type": "image",
"sideNum":1,
"templateCode":"minicard_full_image_landscape",
"data":[
]
}
]
The cards array describes the distribution of sides to the printable surfaces of each card in the pack. The cardNum element represents a unique card in the pack. The elements in the cardSides array define which abstract Side object should be used on each printable face of the Card. The numbers of elements in the cardSides array must be consistent for the product type (e.g. 'image' and 'details' sideTypes for Minicards, Business Cards or Postcards with just 'image' for stickers).
Parameters
"cards":[
{
"cardNum":0,
"cardSides":[
{
"sideNum":1,
"sideType":"image"
},
{
"sideNum":1,
"sideType":"details"
}
]
},
{
"cardNum":1,
"cardSides":[
{
"sideNum":2,
"sideType":"image"
},
{
"sideNum":1,
"sideType":"details"
}
]
}
],
The example above creates 2 cards - one with "image" side 1 and "details" side 1, and the second with "image" side 2, and "details" side 1 again.
The extras array is required only for Sticker products to specify extra information about the pack. The properties that each Extra object provides are:
For Stickers, there must be exactly one Extra item with a key of "pack_colour" and a value in "black", "blue", "green", "orange", "pink", "purple", "white", "yellow"
"extras": [
{
"key": "pack_colour",
"value": "black"
}
]
The Image Basket object holds information about every image used in the Pack user data elements on all Side objects. Given that often, imageData items have resourceUri properties such as filestore://image_original/someFileWeUploaded.jpeg , those URIs cannot be used on the MOO website to provide features such as preview. Instead, we need to have a way to generate browser accessible URLs over HTTP to represent these images in the UI. This is the purpose that the image basket fulfills.
The Image Basket holds an array of items each of which is an ImageBasketItem object.
The ImageBasketItem object has the following properties:
"imageBasket":{
"items":[
{
'shouldEnhance' : false,
'copyrightOwner' : '',
'cacheId' : 'partner_interface_uploader:7b83fe35-75ba-c0a802e8-4c754942-4de8.png',
'type' : 'front',
'resourceUri' : 'filestore://image_original/7b83fe35-75ba-c0a802e8-4c754942-4de8.png',
'removable' : true,
'croppable' : true,
'imageBox' : {
},
'imageItems' : [
'0' : {
'type' : 'print',
'resourceUri' : 'http://www.moo.com/is/o/7b83fe35-75ba-c0a802e8-4c754942-4de8.png',
'width' : 940,
'height' : 330,
'rotation' : 0
},
'1' : {
'type' : 'preview',
'resourceUri' : 'http://www.moo.com/is/r/1024/7b83fe35-75ba-c0a802e8-4c754942-4de8.png',
'width' : 1024,
'height' : 359,
'rotation' : 0
},
'2' : {
'type' : 'thumbnail',
'resourceUri' : 'http://www.moo.com/is/t/75/7b83fe35-75ba-c0a802e8-4c754942-4de8.png',
'width' : 75,
'height' : 75,
'rotation' : 0
}
]
}
],
"type":null,
"name":null,
"immutable":false
}
"pack" => object(
"numCards" => "string",
"productCode" => "string",
"productVersion" => "integer",
"sides" => array(
object (
"sideNum" => "integer",
"templateCode" => "string",
"type" => "string",
"data" => array(
object(
"type" => string,
"linkId" => string,
<< Depending on type, other properties:
"textData" => See Side Object Model
"multiLineTextData" => See Side Object Model
"imageData" => See Side Object Model
"fixedImageData" => See Side Object Model
"boxData" => See Side Object Model
>>
)
)
),
"cards" => array(
object(
"cardNum" => "integer",
"cardSides" => array(
object(
"sideNum" => "integer",
"sideType" => "string",
)
)
)
),
"extras" => array(
object(
"key" => "string",
"value" => "string"
)
),
"imageBasket" => array(
"items" => array(
object(
"resourceUri" => "string",
"name" => "string",
"source" => "string",
"imageBox" => "string",
"removable" => "string",
"croppable" => "string",
"cacheId" => "string",
"imageItems" => array(
object(
"type" => "string",
"resourceUri" => "string",
"width" => "integer",
"height" => "integer",
"rotation" => "float"
)
),
"copyrightOwner" => "string",
"shouldEnhance" => "boolean",
"type" => "string"
),
),
"type" => "string",
"name" => "string",
"immutable" => "boolean"
)
)