Real-life Server API Example

First you need an Printmotor account opened – to know your

  • Service ID
  • User name
  • Password

All requests should be made using HTTPS protocol.

In this example, it’s assumed that Printmotor has opened poster layouts, with sizes 30×40, 40×30, 50×70, 70×50, 70×100 and 100×70 centimeters.

To place and order, a follwing JSON is sent with HTTPS POST to https://api.printmotor.io/api/v1/order

 {
  "orderer" : {
    "firstName": "Jack",
    "lastName": "Surname",
	"emailAddress": "jack@surname.com",
	"phone": "+358101234567"
  },
  "address" : {
    "address" : "2301 Washington Street",
    "address2" : "Suite 132",
    "postalCode" : "94110",
    "postalArea" : "San Francisco",
    "state": "CA",
    "countryIso2" : "US"
  },
  "products" : [
      {
        "layoutName" : "api-poster-50x70",
        "amount" : 1,
        "customization" : [
            {
                "fieldName" : "image",
                "value" : "https://url.com/highres/image/2bd56b3d-f448-4c0e-a86b-234b955e8d2c.png"
            }
        ],
        "endUserPrice": {
            "priceValue": 70,
            "currencyIso4217": "USD"
        }
      }
  ],
  "meta": {
    "reference": "your_order_id_123456"
  }
} 

Where

    • “orderer”
        • the details of the recipient
        • user name and phone number will be written to address label
        • phone number and email address are strongly recommended, mandatory for EXPRESS orders
    • “products”
        • an array of products that will be included in this order
        • for each product:
            • “layoutName”
                • name of the print layout: this will determine poster size, orientation, material and so on implicitly
                • one may use “api-poster-30×40”, “api-poster-50×70”, “api-poster-70×100”, “api-poster-40×30”, “api-poster-70×50”, “api-poster-100×70” where numbers refer to poster sizes (cm)
            • “amount”
                • amount of produced products, commonly 1
            • “customization”
                • this specifies how this product will be customized: commonly holds a single URL that refers to a high resolution, print quality image (PNG or JPEG)
                • specify URL in “image” field as in the example above
            • “endUserPrice”
                • define the price that end user paid for this item
                • will be printed to custom declaration notes where applicable
            • “meta”
                • optional field which contains e.g. your own reference number, which is then searchable in our partner admin

For each HTTPS request, include the following headers

 X-Printmotor-Service: 6ad12412f163584fc6627a854998babf
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l==
Content-Type: application/json 

Where you include your printmotor Service ID, your username and password with HTTP basic authentication, in addition a explicit declaration of JSON as a content type.

A simple GUI for testing the service is e.g. Postman (https://www.getpostman.com) – this may help you to get started with RESTful APIs.

Once orders are sent, you can see sent orders through Printmotor partner admin tool. This is available at https://api.printmotor.io/partner/ – use your API credentials for login.