REST API

Documentation


Order

Print jobs are submitted in the form of orders. An order consists of one or more products and a shipping address. For each product, you must supply one or more files:

  • Books are always in PDF format, cover and content as separate files
  • Products without pages, like posters, may also be supplied in PNG or JPEG format

The exact file specifications of each product can be found in our products list. The API will check if your files meet these specifications.

Be sure to check out the information in our FAQ.
Example

To create an order, you must POST the order details to the API. Using the $api object from the previous step, that's easy. We've provided an example below: you can alter the function get_order_data() to use data from your app or website.

$order = $api->post('/orders', get_order_data());

function get_order_data()
{
    $item1 = array(
        'productId' => 'boek_hc_a5_sta',
        'pageCount' => 32,
        'quantity' => 1,
        'files' => array(                     
            'cover' => 'https://www.printapi.nl/sample-book-a5-cover.pdf',
            'content' => 'https://www.printapi.nl/sample-book-a5-content.pdf'
        )
    );      

    $address = array(
        'name' => 'John Doe',
        'line1' => 'Osloweg 75',
        'postCode' => '9700 GE',
        'city' => 'Groningen',
        'country' => 'NL'
    );

    return array(
        'email' => 'info@printapi.nl',
        'items' => array($item1),                 
        'shipping' => array(
            'address' => $address
        )
    );
}
Special fields:
Name Details
"email" Optional: needed for e-mail confirmations, if enabled
item["productId"] Can be found in the products list
item["pageCount"] Needed only for books and photo prints
item["files"] Optional: you can also upload files later
address["country"] An ISO 3166-1 alpha 2 country code

Want to assign your own ID's to the order and/or its items? Just supply these in an extra field named "id" (max. 36 characters). You may also add a field named "metadata", which allows up to 1 kilobyte of arbitrary data. See the API reference for details.

You can view all of your orders in your account.

By default, the order is awaiting payment from your customer. Alternatively, you can opt for a periodic invoice if you have your own payment system. We'll expand on this in the section Payment.


Optional Product options

When creating an order, you can supply product options. This feature is optional. With product options, you can customize a product in various ways. For example:

  • Posters: laminate gloss or matte
  • Business cards: straight or rounded corners
  • Wood prints: plain or whitewash

Open the products list and open the product you're interested in to see which options we offer. If you're looking for an option that isn't listed there, please feel free to contact us! To supply product options, add an array named options to your item(s):

$item1 = array(
    'productId' => 'visitekaartjes_lig_50st',
    'quantity' => 1,
    'options' => array(
        array('id' => 'finish', 'value' => 'laminate_matte'),
        array('id' => 'corners', 'value' => 'rounded')
    )
);
Special fields:
Name Details
option["id"] The ID listed on the product page.
option["value"] The Value listed on the product page.

You can supply one value per option ID. If you omit an option, the API will automatically select the default value. On the product page, the default option is indicated by ("standaard"). Note that non-standard options may have an additional cost.

Next