Methods
All Methods
Pack Methods
Template Methods
Image Methods
- moo.image.uploadImage - Upload an image from the application into the MOO image system for use in a Pack
- moo.image.importImage - Imports an image from a given HTTP URI into the MOO image system for use in a Pack
Common parameters
- All methods support the following additional optional parameters:
-
- errorsAsOK: boolean (default false) - If true then a 200 OK will be returned on errors, if false then a 500 will be returned.
- responseContentType: string (default "application/json") - The content type header to send on the returned document.
Pack Methods
The moo.pack.createPack method creates a pack and returns an id that can be used in subsequent moo.pack.updatePack and moo.pack.getPack calls. If the product is invalid, an error is returned.
- HTTP Method
-
- Authentication
-
- "create" permission required - This permissions is granted to all MOO API keys
- OAuth authentication required - This call requires a signed 2-legged call
- Parameters
-
- method: string -
moo.pack.createPack
- product: string - The code of the product to be created. See Product Codes for a list of available products
- pack: URI encoded Pack JSON - Optionally, the pack object data. See the Pack Object Model for more information on this object
- trackingId: string - An optional API client provided string used to track API calls which result in order placement - max 255 characters. This will be stored in our DB if the customer places an order with this pack, and will be sent to you in an AJAX call from the MOO confirmation page if you have configured an Order Confirmation Callback URL. For more details, please see the Order Tracking documentation
- friendlyName: string - An optional API client provided string as the default "name" of the pack, used to name the Pack if the user wishes to save it, to identify it when they add it to the cart, and in their order history. The user can rename their pack.
- startAgainUrl: string - An optional API client provided absolute URL which will be used if the customer wishes to start their pack all over again from our Design Canvas page. Typically this should lead them back to the appropriate page in your application
- physicalSpec: URI encoded Physical Specification JSON - Optionally, the physical specification of the pack. See the Physical Specification for more information on this object
- includePhysicalSpec: boolean - If set to
true then the response will include details of the physical specification of the Pack. This parameter is optional and defaults to false to preserve backward compatibility
Example Request
POST /api/service/
method=moo.pack.createPack&product=businesscard
Example Response. For more information, see the Pack Object Model specification.
{
"packId": "4f1d6939-546f-aa9aec3b-4f5e41f0-e093", //The newly created Pack ID.
"pack":{
... /* Pack data object */
},
"warnings": [
... /* Warnings array */
],
"dropIns":{
... /* Available Drop-in string -> string map */
},
"physicalSpec": {
... /* Physical Specification object */
}
}
The moo.pack.getPack method returns the pack object for the specified id. If the id does not exist, an error is returned.
- HTTP Method
-
- Authentication
-
- "read" permission required - All API users have the ability to read packs created with their key, until the customer takes ownership of the pack using one of the drop-in URLs
- OAuth authentication required - This call requires a signed 2-legged call
- Parameters
-
- method: string -
moo.pack.getPack
- packId: string - The id of the required pack
- includePhysicalSpec: boolean - If set to
true then the response will include details of the physical specification of the Pack. This parameter is optional and defaults to false to preserve backward compatibility
Example Request
GET /api/service/?method=moo.pack.getPack&packId=4f1d6939-546f-aa9aec3b-4f5e41f0-e093
Example Response. For more information, see the Pack Object Model specification.
{
"packId": "4f1d6939-546f-aa9aec3b-4f5e41f0-e093", //The Pack ID requested.
"pack":{
... /* Pack data object */
},
"warnings": [
... /* Warnings array */
],
"dropIns":{
... /* Available Drop-in string -> string map */
},
"physicalSpec": {
... /* Physical Specification object */
}
}
The moo.pack.getPhysicalSpec method returns the physical specification object for the specified id. If the id does not exist, an error is returned.
- HTTP Method
-
- Authentication
-
- "read" permission required - All API users have the ability to read packs created with their key, until the customer takes ownership of the pack using one of the drop-in URLs
- OAuth authentication required - This call requires a signed 2-legged call
- Parameters
-
- method: string -
moo.pack.getPhysicalSpec
- packId: string - The id of the required pack
Example Request
GET /api/service/?method=moo.pack.getPhysicalSpec&packId=4f1d6939-546f-aa9aec3b-4f5e41f0-e093
Example Response. For more information, see the Physical Specification.
{
"packId": "4f1d6939-546f-aa9aec3b-4f5e41f0-e093", //The Pack ID requested.
"physicalSpec": {
... /* Physical Specification object */
}
}
The moo.pack.updatePack method updates a pack with the supplied pack. If the id does not exist, or the pack is invalid, an error is returned.
- HTTP Method
-
- Authentication
-
- "update" permission required - All API users have the ability to update packs created with their key, until the customer takes ownership of the pack using one of the drop-in URLs
- OAuth authentication required - This call requires a signed 2-legged call
- Parameters
-
- method: string -
moo.pack.updatePack
- packId: string - The ID of the Pack to be updated
- pack: URI encoded Pack JSON - The pack object data. See the Pack Object Model for more information on this object
- friendlyName: string - An optional API client provided string as the default "name" of the pack, used to name the Pack if the user wishes to save it, to identify it when they add it to the cart, and in their order history. The user can rename their pack.
- includePhysicalSpec: boolean - If set to
true then the response will include details of the physical specification of the Pack. This parameter is optional and defaults to false to preserve backward compatibility
Example Request
POST /api/service/
method=moo.pack.updatePack&packId=4f1d6939-546f-aa9aec3b-4f5e41f0-e093&pack={}
Example Response. For more information, see the Pack Object Model specification.
{
"packId": "4f1d6939-546f-aa9aec3b-4f5e41f0-e093", //The Pack ID requested for the update
"pack":{
... /* Pack data object */
},
"warnings": [
... /* Warnings array */
],
"dropIns":{
... /* Available Drop-in string -> string map */
},
"physicalSpec": {
... /* Physical Specification object */
}
}
The moo.pack.updatePhysicalSpec method updates a pack with the supplied physical specification. If the id does not exist, or the pack is invalid, an error is returned.
- HTTP Method
-
- Authentication
-
- "update" permission required - All API users have the ability to update packs created with their key, until the customer takes ownership of the pack using one of the drop-in URLs
- OAuth authentication required - This call requires a signed 2-legged call
- Parameters
-
- method: string -
moo.pack.updatePhysicalSpec
- packId: string - The ID of the Pack to be updated
- physicalSpec: URI encoded Physical Specification JSON - The physical specification object. See the Physical Specification for more information on this object
Example Request
POST /api/service/
method=moo.pack.updatePhysicalSpec&packId=4f1d6939-546f-aa9aec3b-4f5e41f0-e093&physicalSpec={}
Example Response. For more information, see the Physical Specification specification.
{
"packId": "4f1d6939-546f-aa9aec3b-4f5e41f0-e093", //The Pack ID requested for the update
"physicalSpec": {
... /* Physical Specification object */
}
}
The moo.pack.addToCart method adds the specified pack to the cart. If the id does not exist, an error is returned.
- HTTP Method
-
- Authentication
-
- "add_to_cart" permission required - Contact MOO to request that this permission be added to your account
- OAuth authentication required - This call requires a signed 2-legged call
- Parameters
-
- method: string -
moo.pack.updatePack
- packId: string - The ID of the Pack to be updated
- quantity: int - the quantity of this Pack to be added to the Cart
Example Request
POST /api/service/
method=moo.pack.addToCart&packId=4f1d6939-546f-aa9aec3b-4f5e41f0-e093&quantity=1
Example Response. For more information, see the Pack Object Model specification.
{
"warnings": [
... /* Warnings array */
],
"dropIns":{
... /* Available Drop-in string -> string map */
}
}
Template Service Methods
The moo.template.getTemplate method returns the template for the specified id. If the id does not exist, an error is returned.
- HTTP Method
-
- Authentication
-
- "get_template" permission required - All API accounts are granted this permission
- OAuth authentication OPTIONAL - This call will succeed with or without a signed call
- Parameters
-
- method: string -
moo.template.getTemplate
- templateCode: string - The code of the Template to be returned as XML
Example Request
GET /api/service/?method=moo.template.getTemplate&templateCode=businesscard_front_variable_full
Example Response. For more information, see the Template Object Model specification.
<?xml version="1.0" encoding="UTF-8"?>
...
Image Service Methods
The methods moo.image.importImage and moo.image.uploadImage can be used to create images in the MOO filestore for later use in other API methods such as moo.pack.createPack, moo.pack.updatePack and moo.pack.addToBasket. Importing and uploading images are useful when use of static public URLs to reference images is not possible or is undesirable. The right image method to use depends upon how the source images is stored and/or generated.
Images must be one of the following types:
- PNG - Unfortunately, we don't currently support the PNG-24 format at the moment I'm afraid. We also don't support image transparency within PNGs. For transparency, use PDFs (or embed the PNG within a PDF document)
- JPEG - The higher compression quality the better for JPEGs.
- PDF - We support PDFs as "images". Note that not all features of the PDF standard are supported. Contact MOO if you have any questions about the use of a PDF in your application
- GIF - while we accept GIF images, we strongly discourage them as the quality will likely be poor when printed in most cases
The moo.image.uploadImage method uploads and adds the image data to the MOO image store and returns an Image Item Basket Item object. This should be used for most images being supplied by your application. The rights on the images uploaded to MOO are unaffected - we will only use the images for the purposes of producing the printed product you order.
- HTTP Method
-
- Authentication
-
- NOT ALLOWED - "upload_image" permission is granted to all requests.- OAuth is often rather vague about how to sign multipart forms, and Flash applications have some issues in certain browsers with maintaining cookies and the like for multipart form posts. As a result, this call an be unauthenticated.
- Parameters
-
- method: string -
moo.image.uploadImage
- imageType: string (optional, default "unknown") - the type of image, used to decide if image enhancement should be used by default. Valid values are "unknown", "photo", "lineart" or "detect". Detect will enable our photo detection system to establish the type of image, photo will enable enhancement by default, and unknown will disable enhancement by default. Currently lineart is equivalent to unknown, but this may change in the future.
- imageFile: multipart file upload - the binary data should be passed as a multipart field called "imageFile"
Example Request
POST /api/service/
method=moo.image.uploadImage
Example Response. For more information, see the Pack Object Model specification.
{
"imageBasketItem":{
...
"items":[
...
]
}
}
The moo.image.importImage method uploads and adds the image data to the MOO image store and returns an Image Item Basket Item object.
- HTTP Method
-
- Authentication
-
- "import_image" permission is required.- Contact MOO if you would like to have this permission added to your account
- OAuth authentication required - This call requires a signed 2-legged call
- Parameters
-
- method: string -
moo.image.uploadImage
- imageType: string (optional, default "unknown") - the type of image, used to decide if image enhancement should be used by default. Valid values are "unknown", "photo", "lineart" or "detect". Detect will enable our photo detection system to establish the type of image, photo will enable enhancement by default, and unknown will disable enhancement by default. Currently lineart is equivalent to unknown, but this may change in the future.
- imageUrl: string - HTTP accessible URI to get the image
Example Request
POST /api/service/
method=moo.image.importImage&imageUrl=http://example.com/image1.jpeg
Example Response. For more information, see the Pack Object Model specification.
{
"imageBasketItem":{
...
"items":[
...
]
}
}