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. Using the client
object from the
previous step, that's easy. We've
provided an example below: you can alter the method _getOrderData()
to use data
from your app or website.
var order = await client.Orders.PostAsync(_getOrderData());
private PrintApi.Input.Order _getOrderData()
{
var item1 = new PrintApi.Input.Order.Item
{
ProductId = "boek_hc_a5_sta",
PageCount = 32,
Quantity = 1,
Files = new PrintApi.Input.Order.Item.FileList
{
Cover = "https://www.printapi.nl/sample-book-a5-cover.pdf",
Content = "https://www.printapi.nl/sample-book-a5-content.pdf",
}
};
var address = new PrintApi.Input.Address
{
Name = "John Doe",
Line1 = "Osloweg 75",
PostCode = "9700 GE",
City = "Groningen",
Country = Country.NL
};
return new PrintApi.Input.Order
{
Email = "info@printapi.nl",
Items = new[] { item1 },
Shipping = new PrintApi.Input.Order.ShippingInfo
{
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.
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):
var item1 = new PrintApi.Input.Order.Item
{
ProductId = "visitekaartjes_lig_50st",
Quantity = 1,
Options = new[]
{
new PrintApi.Input.Order.Item.Option { Id = "finish", Value = "laminate_matte" },
new PrintApi.Input.Order.Item.Option { 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.