Dielines API for Developers

You can offer the same service on your own website by using our Dielines API. We help with integration and charge a flat fee for access to our generator.

How It Works?

We provide a simple API that lets you browse dielines and their parameters, get previews of given dielines exactly as on our site and finally request vector versions of dielines you need. You get EPS files immediately and then forward them to your customers for free or for a fee. Simple!

Show Me The Code

Sure, the code is below. There are three types of methods in the API:

  1. Getting dielines and collections lists;
  2. Getting parameters of a given dieline and its preview;
  3. Requesting the EPS file of a given dieline with parameters.

Below we provide the methods you can use and expected responses of our generator. In most cases you make a simple GET request and receive a JSON reply from the server.

Getting dielines

You can query the list of dieline categories this way:

https://dielines.boxshot.com/collections

The response is the array of collection names:

[ "ECMA", "FEFCO" ]

Then you can query the dielines of a given collection:

https://dielines.boxshot.com/collections/FEFCO/dielines

The response is the array of dictionaries, where each dictionary represents a dieline:

[
	{
        "id" : "fefco-0200",
        "name" : "0200",
        "description" : "Half Slotted Container"
	},
	{
        "id" : "fefco-0201",
        "name" : "0201",
        "description" : "Regular Slotted Container"
	},
	...
]

Or you can get all the dielines at once using this query:

https://dielines.boxshot.com/dielines

The response is pretty much the same, only “collection” field is added:

[
	{
        "id" : "fefco-0200",
        "name" : "0200",
        "description" : "Half Slotted Container",
        "collection" : "FEFCO"
	},
	{
        "id" : "fefco-0201",
        "name" : "0201",
        "description" : "Regular Slotted Container",
        "collection" : "FEFCO"
	},
	...
]

Once you got a dieline identifier you can query its parameters.

Getting parameters

Each dieline has the list of parameters that you can see at the left when use our dieline editor. You can get this list by providing the dieline id using this query:

https://dielines.boxshot.com/dielines/{id}/vars2

For instance, for FEFCO–0300 the query is:

https://dielines.boxshot.com/dielines/fefco-0300/vars2

The response is the array of dictionaries, where each dictionary represents a variable:

[
	{
        "name" : "Height",
        "type" : "length",
        "value" : 269.291,
        "min" : 50,
        "max" : 10000
	},
	{
        "name" : "Part",
        "type" : "option",
        "value" : 0,
        "options" : ["Bottom","Top"]
	},
	{
        "name" : "Double Lock",
        "type" : "bool",
        "value" : false
	},
	...
]

Each variable has “name” and “type” parameters. Name is displayed to the user, type is used to parse the rest of the dictionary. There are three types of variables:

You get the list of variables and present them to the user the way you need. You may also want to convert units to inches or millimeters and back. Once the user configured the properties, you can query a preview of the dieline with those properties:

https://dielines.boxshot.com/dielines/{id}/preview?....params....

Where “id” is the dieline identifier and “…params…” is a GET–like query with all the variables and their values. Here are some real–world examples:

https://dielines.boxshot.com/dielines/fefco-0427/preview?Length=600&Width=400&Height=170&Paper%20Thickness=2.8&Double%20Lock=true
https://dielines.boxshot.com/dielines/fefco-0300/preview?Length=600&Width=400&Height=170&Paper%20Thickness=2.8&Top%20Part%20Offset=0&Part=Bottom

Here’s what you need to send back for variables of supported types:

The generator returns a PNG preview of the specified dieline that you show to the user.

Another API for getting preview is this:

https://dielines.boxshot.com/dielines/fefco-0427/preview4?Length=600&Width=400&Height=170&Paper%20Thickness=2.8&Double%20Lock=true

Note that the url has /preview4 at the end, instead of just /preview. The difference is that /preview4 returns a JSON file with both preview image and list of errors found in the input parameters. You may display the errors to the user, so they correct the input and get a proper dieline generated.

Requesting the dielines

Once the parameters are configured and preview looks good, you can request the dieline by sending a POST request to one of the following urls:

https://dielines.boxshot.com/generate/partner/eps
https://dielines.boxshot.com/generate/partner/json
https://dielines.boxshot.com/generate/partner/zip

The requests should contain the form–encoded parameters:

The first url obviously returns the EPS file of the dieline, the second returns the dieline in JSON format internally used by Origami. You can use it for loading to Origami or for command–line processing with it. The ZIP format contains both EPS and JSON files and also the folded 3D model of the dieline in OBJ format and an interactive self–containing 3D viewer in HTML format.

Download a sample zip file by clicking the ZIP button at the top right corner of the window. Note that this file doesn’t contain the JSON data, as it is for online orders. The ZIP file generated using the link above will have the JSON file.

Questions?

What is the price?

The price is USD $99 a month paid upfront for a year. This gives $1188 that you pay and get the secret key to access the EPS/JSON/ZIP generation API.

Any API usage limits?

We do not limit the layouts, variables and preview API calls, but the fair usage policy still applies.

The number of EPS/JSON/ZIP generations should not exceed 1000 per day. Let us know if you plan to generate more dielines, so we can provide extra capacity for you. Note that this will affect the price mentioned above.

Any other limitations?

The EPS/JSON/ZIP generation API uses a secret key which needs to be kept private. This means those API calls should not be done on the client side, as this way the secret key becomes public. We block such keys and it takes time to get the new one, so calling the generation API from server is a good idea.

The rest of the API can be called from the client side.

How to get the secret code?

This is simple: contact us, make the payment, get the code. Your 12 months period starts when you get the code, so it might be a good idea to implement the “free” part of the API first to make sure it works the way you need, then get the secret key from us and start using the service immediately.

Anything else?

No, contact us when you are ready to order the key. Simple :)