Getting started


Starting point

The starting point of this API is the Create article endpoint. Calling this endpoint will make a new article. The newly made article will automatically be assigned to a new order, or an existing one if you still had an open/non-finished order.
You can get the article ID and its linked order ID by looking at the location header of the response of Create article.

Next steps

Now that you have succesfully created an article and therefore a new order, you can use the order ID and article ID to call any of the other endpoints.
Should you want multiple articles in your order, then you can simply call the Create article endpoint again. This places the requested article in your order if it is still open. An order is considered "open" as long as Finish order isn't called.

Finishing the order

You can finish an order by calling the Finish order endpoint. Before you are able to do this, you first have to set the delivery data for your order.
Once you have set your delivery data and you have atleast 1 article in your order, then you are able to succesfully call the Finish order endpoint. It's optional to pass a couponcode when finishing the order, but if it isn't omitted it expects a valid and active couponcode. Passing an invalid couponcode will result in your request being denied by the API.

Example

We are starting off by calling the Create article endpoint, as that is the starting point for this API. To find out what JSON params you need to pass in the payload, click the name of the article you're creating in the sidebar.

Raw request

POST https://printenbind.nl/api/v1/orders/articles
Authorization: API_KEY

{
    "product": "boek",
    "number": "50",
    "copies": "120",
    "color": "none",
    "size": "a5",
    "printside": "double",
    "papertype": "80",
    "finishing": "garenloos inbinden",
    "spine": "blanco",
    "papertype_cover": "350",
    "check_doc": "standard",
    "add_file_method": "upload",
    "filenames": "example.pdf"
}

Example response

date: Fri, 15 Dec 2017 13:13:37 GMT
server: Apache/2.4.27 (Win32) PHP/7.1.9 OpenSSL/1.0.2l
x-ratelimit-remaining: 10
content-type: text/html
location: orders/113/articles/106195
x-ratelimit-limit: 10
connection: Keep-Alive
keep-alive: timeout=5, max=100
content-length: 0
status: 201 Created



In this case, we have the order ID "113" and article ID "106195". By calling the Create Article endpoint again, we would be placing another article under order ID "113".
To continue, we are going to set our delivery information by calling the Set delivery data endpoint:

Raw request

POST https://printenbind.nl/api/v1/delivery/113
Authorization: API_KEY

{
  name_contact: "Printenbind",
  street: "Kabelweg",
  city: "Amsterdam",
  streetnumber: "44A",
  zipcode: "1014BB",
  country: "NL"
  delivery_method: "mailbox",
  production_method: "fast"
}

Example response

date: Fri, 15 Dec 2017 13:17:57 GMT
server: Apache/2.4.27 (Win32) PHP/7.1.9 OpenSSL/1.0.2l
x-ratelimit-remaining: 10
content-type: text/html
location: delivery/113
x-ratelimit-limit: 10
connection: Keep-Alive
keep-alive: timeout=5, max=100
content-length: 0
status: 201 Created

Since we received a 201 (CREATED) response, we know the delivery has succesfully been set. This means that we can continue to finish our order now.
We can finish our order by calling the Finish order endpoint.

Raw request

POST https://printenbind.nl/api/v1/order/113/finish

Example response

date: Fri, 22 Dec 2017 11:32:13 GMT
server: Apache/2.4.27 (Win32) PHP/7.1.9 OpenSSL/1.0.2l
transfer-encoding: chunked
content-type: application/json
location: orders/113
x-ratelimit-remaining: 10
x-ratelimit-limit: 10
connection: Keep-Alive
keep-alive: timeout=5, max=100
status: 201 CREATED

Now you have succesfully placed your order! You can access the data of the order at any time by calling Get order endpoint. However, at this point in time you won't be able to make any chances to the articles in your order anymore.
Should you want to place another order, you can simply call the Create article endpoint again. This will place your article under a new order ID.