REST API
Documentation
- Nederlands
- English
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.
Example
To create an order, you must POST the order details to the API. We recommend supplying JSON data, but XML is also supported. Make sure your Content-Type and Accept HTTP headers are set correctly.
POST /v2/orders HTTP/1.1
Authorization: Bearer TOKEN
Accept: application/json
Content-Type: application/json
{
"email": "info@printapi.nl",
"items": [
{
"productId": "boek_hc_a5_sta",
"pageCount": 32,
"quantity": 1,
"files": {
"content": "https://www.printapi.nl/sample-book-a5-content.pdf",
"cover": "https://www.printapi.nl/sample-book-a5-cover.pdf"
}
},
],
"shipping": {
"address": {
"name": "John Doe",
"line1": "Osloweg 75",
"postCode": "9700 GE",
"city": "Groningen",
"country": "NL"
}
}
}
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.
HTTP/1.1 201 Created
Content-Type: application/json;charset=UTF-8
Content-Length: 746
Location: https://test.printapi.nl/v2/orders/83432183
{
"id": "83432183",
"status": "Created",
"dateTime": "2015-10-21T12:53:06.9931422",
"email": "info@printapi.nl",
"items": [
{
"id": "07453",
"productId": "boek_hardcover_a5_sta",
"pageCount": 32,
"quantity": 1,
"files": {
"content": {
"status": "DownloadPending",
"downloadUrl": "https://www.printapi.nl/sample-book-a5-content.pdf"
},
"cover": {
"status": "DownloadPending",
"downloadUrl": "https://www.printapi.nl/sample-book-a5-cover.pdf"
}
}
}
],
"shippingAddress": {
"name": "John Doe",
"line1": "Osloweg 75",
"postCode": "9700 GE",
"city": "Groningen",
"country": "NL"
}
}
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):
"items": [
{
"productId": "visitekaartjes_lig_50st",
"quantity": 1,
"options": [
{ "id": "finish", "value": "laminate_matte" },
{ "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.