Cloudprinter order API JSON

This documentation describes the Cloudprinter order API JSON v2.2


Getting started

To get started with Cloudprinter please contact us at info@cloudprinter.com to get your account created. To each account is associated an API key, which is used as authentication in all API calls.


Basics

This API is Used for deliverying order from Cloudprinter to a production. JSON document posted to the productions API.

The order document in JSON format is posted at the productions order endpoint. The document consists of one order, one or more items and reference to the needed production files for the specific product.

Communication

The JSON document is delivered with a HTTP POST request to a API endpoint over HTTPS or HTTP. The HTTP response code 200 indicate success, all other response codes are treated as error.


Order JSON format

The order JSON document containes all needed information for printing and shipping the products. This example is a very basic order with one item.

Example order JSON

json
{
    "order": {
        "apikey": "13b37bb1ed6d3403e158abe719b4f6d0",
        "id": "123456780000",
        "date": "2016-07-14 08:25:08",
        "priority": "2",
        "shipping_date": "2016-07-15 08:25:08",
        "creator": {
            "id": 1,
            "name": "Cloudprinter.com",
            "version": "2.2",
            "date": "2016-07-14 08:25:08"
        },
        "client": {
            "id": 1,
            "name": "Cloudprinter.com",
            "date": "2016-01-20 08:25:08",
            "reference": "d15ddd390457e4f581e0835a979465df"
        },
        "costs": {
              "currency": "EUR",
              "shipping": "4.2000",
              "items": "7.0000",
              "vat": "0.0000",
              "total": "11.2000"
        },
        "shipping": {
            "method": "fedex_national_2_day",
            "consignor": "The Book Company",
            "invoice": {
                "shipments": 1,
                "currency": "EUR",
                "total": "4.2000"
            },
            "proforma_invoice": {
                "currency": "EUR",
                "total": "14.0000",
                "weight": "173.6986"
            }
        },
				"addresses": [
            {
                "type": "delivery",
                "company": "Example company",
                "name": "Example name",
                "street1": "Example street 1234",
                "street2": "Building 5",
                "zip": "99999",
                "city": "Example city",
                "country": "US",
                "state": "NY",
                "email": "email@example.com",
                "phone": "12345678",
                "customer identification": ""
            }
        ],
       "files": [
            {
                "type": "shipping_label",
                "format": "pdf",
                "url":    "https://s3-eu-west-1.amazonaws.com/a484c8da5ea1ce9c1db76eb04fdfc055f1aeb3ae597e5c.cloudprinter.com/106733300030000/106733300030000_shipping_label.pdf",
                "md5sum": "1455a007e7806c17aaf319701ce7f764",
                "size": 58586
            }
        ],
        "items": [
            {
                "id": "123456780001",
                "count": 1,
                "title": "Building High-Availability RESTful Services",
                "product": "textbook_cw_a3_p_fc",
                "desc": "Textbook Casewrap (PUR, 3 mm board) A3 Portrait DIG FC 80OFF",
                "pages": "44",
                "files": [
                    {
                        "type": "cover",
                        "format": "pdf",
                        "url": "https://s3-eu-west-1.amazonaws.com/13b37bb1ed6d3403e158abe719b4f6d0.cloudprinter.com/29c1d90b21bd7c8d28ba1fd1ae7646eb_cover.pdf",
                        "md5sum": "4578c3ecf64e47581b175d542f8b0160",
                        "size": 20785
                    },
                    {
                        "type": "book",
                        "format": "pdf",
                        "url": "https://s3-eu-west-1.amazonaws.com/13b37bb1ed6d3403e158abe719b4f6d0.cloudprinter.com/29c1d90b21bd7c8d28ba1fd1ae7646eb_book.pdf",
                        "md5sum": "1ef89e74e628e223ae94aa4586330833",
                        "size": 77459
                    }
                ],
                "options": [
                    {
                        "option": "pageblock_80off",
                        "desc": "Pageblock paper 80gsm Offset",
                        "count": 44,
                        "type": "type_main_paper"
                    },
                    {
                        "option": "cover_finish_gloss",
                        "desc": "Cover lamination Gloss finish",
                        "count": 1,
                        "type": "type_book_cover_finish"

                    }
                 ],
                "reorder_desc": "damaged parcel",
                "reorder_order_id": "1046305470000",
                "reorder_item_id": "1046305470002",
                "reorder_cause": "reorder_shipping_item_damaged"
            }
        ]
    }
}

Parameters

Document root

NameTypeDescriptionRequired
orderobjectOrder informationrequired
apikeystringAPI key specific to the productionrequired
idstringCloudprinters order idrequired
datestringOrder daterequired
prioritystringThe number of days for productionoptional
shipping datestringDate by which the order is expected to be shipped to the customeroptional

Creator

NameTypeDescriptionRequired
creatorobjectInformation on the creator of the documentrequired
creator : idnumberID of the creator servicerequired
creator : namestringName of the creator servicerequired
creator : versionstringVersion of the document creatorrequired
creator : datestringDate of document generationrequired

Client

NameTypeDescriptionRequired
clientobjectInformation on the client businessrequired
client : idnumberID of the client businessrequired
client : namestringName of the client businessrequired
client : referencestringThe order reference of the client businessrequired
client : datestringOrder date registered by the client businessoptional

Costs

NameTypeDescriptionRequired
costsobjectInformation on overall costsrequired
costs : currencystringCurrency of the transactionrequired
costs : shippingstringShipping costrequired
costs : itemsstringItems costrequired
costs : vatstringVAT costrequired
costs : totalstringTotal costrequired

Shipping

NameTypeDescriptionRequired
shippingobjectInformation on shippingrequired
shipping : methodstringThe shipping carrier and service for the orderrequired
shipping : consignorstringThe consignor name for the shipping labelrequired
shipping : invoiceobjectInformation on shipping invoicing datarequired
shipping : invoice : shipmentsnumberExpected number of shipmentsrequired
shipping : invoice : currencystringCurrency of shipment total costrequired
shipping : invoice : totalstringTotal shipment invoice costrequired
shipping : proforma_invoiceobjectInformation on the proforma invoice related to shippingrequired
shipping : proforma_invoice : currencystringThe currency used in the proforma invoice (e.g., EUR)required
shipping : proforma_invoice : totalstringTotal amount specified in the proforma invoicerequired
shipping : proforma_invoice : weightstringWeight of the shipment related to the proformarequired

Addresses

NameTypeDescriptionRequired
addressesarrayArray of delivery address objectsrequired
addresses : typestringType of address - valid values are: "delivery"required
addresses : companystringEnd customers company nameoptional
addresses : namestringEnd customers namerequired
addresses : street1stringEnd customers street namerequired
addresses : street2stringEnd customers street nameoptional
addresses : zipstringEnd customers zip/postal coderequired
addresses : citystringEnd customers city namerequired
addresses : statestringEnd customers state name - ANSI INCITS 38:2009 alpha-2 - required for USoptional
addresses : countrystringEnd customers country - ISO 3166-1 alpha-2required
addresses : emailstringEnd customers email address - used in case of problems during deliveryoptional
addresses : phonestringEnd customers phone number - used in case of problems during deliveryoptional
addresses : customer_identificationstringEnd customers customer identification also known as CPF, CI, etc. - Read moreoptional

Items

NameTypeDescriptionRequired
itemsarrayArray with one or more item objectsrequired
items : idstringCloudprinters item idrequired
items : countnumberThe number of copies to produce of this specific itemrequired
items : titlestringThe title of the item projectoptional
items : productstringThe name of the productrequired
items : descstringShort description text of the productoptional
items : pagesstringThe number of pages in the book blockoptional
items : filesarrayArray with one or more file objectsrequired
items : files : typestringThe type of file - valid values are: "product", "cover", "book", "archive"required
items : files : formatstringThe format of file - valid values are: "pdf", "jpg", "zip"required
items : files : urlstringURL to the product file for the specific itemrequired
items : files : md5sumstringMd5 sum of the file - used for validationrequired
items : files : sizenumberSize of the file in bytes - used for validationrequired
items : optionsarrayArray with zero or more option objectsoptional
items : options : optionstringProductions product id for the addonrequired
items : options : descstringShort description of the addonrequired
items : options : countnumberThe quantity of the addon requiredrequired
items : options : typestringOption category type referencerequired
items : reorder_causestringA predefined set of reorder causesoptional
items : reorder_descstringCustom text to give more details on the issueoptional
items : reorder_order_idstringReference back to the original order idoptional
items : reorder_item_idstringReference back to the original item idoptional

Files

The files section provides the general order level files, this could be a shipping label or promotional material.

NameTypeDescriptionRequired
filesarrayList of file objectsoptional
files : typestringThe type of file - valid values are: "shipping_label", "promotion"required
files : formatstringFormat of the file in the orderrequired
files : urlstringURL to the order filerequired
files : md5sumstringMd5 sum of the file - used for validationrequired
files : sizenumberSize of the file in bytes - used for validationrequired