Order Structure

Orders can reference Piazza products on submission rather than including all product information like components. See below for JSON structure differences.

Overview

The basic JSON order structure is shown below

{
     "destination":  { },
     "orderData": {
          "items": [
               {
                    "sourceProductId": ""
               }
          ],
          "shipments": [
               {
                    "shipTo": { },
                    "returnAddress": { },
                    "carrier": { }
               }
          ]
     }
}

Orders are submitted using a predefined JSON structure, any additional fields or child elements in the structure will be ignored.

Piazza Order Structure

The main differences to regular orders are:

  • Each item must contain sourceProductId, that references a Title previously setup in Piazza
  • Each item must not contain the components list, because the components for a Title are taken from Piazza

Below is an example of a full order structure including fields that have default values.
It is not necessary to include all of these fields in the order.

{
     "destination": {
          "name": "printcompanyx"
     },
     "orderData": {
          "sourceOrderId": "41324132",
          "customerName": "Customer Name",
          "extraData": {},
          "items": [
               {
                    "sourceItemId": "ORDER-13243124",
                    "sourceProductId": "9781718901438",
                    "quantity": 1,
                    "description": "Photo Book",
                    "shipmentIndex": 0
               }
          ],
          "shipments": [
               {
                    "sourceShipmentId": "SHIPMENT-13243124-1",
                    "shipmentIndex": 0,
                    "shipByDate": "2013-07-12",
                    "slaDays": 1,
                    "canShipEarly": true,
                    "shipTo": {
                         "name": "Peter Pan",
                         "companyName": "Disney Corporation",
                         "address1": "17 Disney Way",
                         "address2": "",
                         "address3": "",
                         "town": "Los Angeles",
                         "postcode": "34757",
                         "state": "California",
                         "isoCountry": "US",
                         "country": "United States of America",
                         "email": "peter@disney.com",
                         "phone": "+12345678910"
                    },
                    "returnAddress": {
                         "name": "Peter Pan",
                         "companyName": "Disney Corporation",
                         "address1": "17 Disney Way",
                         "address2": "",
                         "address3": "",
                         "town": "Los Angeles",
                         "postcode": "34757",
                         "state": "California",
                         "isoCountry": "US",
                         "country": "United States of America",
                         "email": "peter@disney.com"
                    },
                    "carrier": {
                         "alias": "CUSTOM_SHIPPING"
                    },
                    "attachments": [
                         {
                              "path": "http://some.site.com/files/insert.pdf",
                              "type": "insert"
                         }
                    ]
               }
          ]
     }
}