This subpage contains description about the implementation of our algorithms into your system. Our alghorithms were created to optimize and visualize packing of cubic items in in various cubic shaped loading spaces. Each our algorithm is possible to connect via the API which accepts requests and returns responses in JSON format.
What is an API?
An API is a set of programming code that enables data transmission between one software product and another. It also contains the terms of this data exchange.
Get started
To use our API, you need to register on our website (www.3dbinpacking.com) and get your username and API key.
In case you like to test our API, please replace username and api key given below and paste them into the browser address bar.
Currently we have a few servers running around the world for high availability, low latency.
Our global API server is the best. This server will redirect your request to the closest available server.
The list of 3DBinPacking API endpoints:
packagejavaapplication1;importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStreamWriter;importjava.net.HttpURLConnection;importjava.net.MalformedURLException;importjava.net.ProtocolException;importjava.net.URL;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;;importorg.json.simple.JSONObject;importorg.springframework.web.client.RestTemplate;publicclassJavaApplication1{/**
* @param args the command line arguments
*/publicstaticvoidmain(String[]args)throwsMalformedURLException,ProtocolException,IOException{RestTemplaterestTemplate=newRestTemplate();JSONObjectjson=newJSONObject();//SET BINSList<Map<String,String>>bins=newArrayList<Map<String,String>>();Map<String,String>bin1=newHashMap<String,String>();bin1.put("id","Pack M");bin1.put("h","4");bin1.put("w","4");bin1.put("d","4");bin1.put("wg","");bin1.put("max_wg","");bins.add(bin1);Map<String,String>bin2=newHashMap<String,String>();bin2.put("id","Pack S");bin2.put("h","3");bin2.put("w","3");bin2.put("d","6");bin2.put("wg","");bin2.put("max_wg","");bins.add(bin2);//SET ITEMSList<Map<String,String>>items=newArrayList<Map<String,String>>();Map<String,String>item1=newHashMap<String,String>();item1.put("id","Speakers");item1.put("w","3");item1.put("h","3");item1.put("d","3");item1.put("wg","2");item1.put("q","3");item1.put("vr","1");items.add(item1);Map<String,String>item2=newHashMap<String,String>();item2.put("id","Bigger item");item2.put("w","3");item2.put("h","3");item2.put("d","5");item2.put("wg","1");item2.put("q","2");item2.put("vr","1");items.add(item2);//SET PARAMETERSMap<String,String>params=newHashMap<String,String>();params.put("images_background_color","255,255,255")params.put("images_bin_border_color","59,59,59")params.put("images_bin_fill_color","230,230,230")params.put("images_item_border_color","22,22,22")params.put("images_item_fill_color","255,193,6")params.put("images_item_back_border_color","22,22,22")params.put("images_sbs_last_item_fill_color","177,14,14")params.put("images_sbs_last_item_border_color","22,22,22")params.put("images_format","svg")params.put("images_width","50")params.put("images_height","50")params.put("images_source","file")params.put("stats","0")params.put("item_coordinates","1")params.put("images_complete","1")params.put("images_sbs","1")params.put("images_separated","0")//ADD ELEMENTS TO JSONjson.put("username","YOUR_USERNAME");json.put("api_key","YOUR_API_KEY");json.put("items",items);json.put("bins",bins);json.put("params",params);//CALL QUERYHttpURLConnectionconn;URLaddr=newURL("https://global-api.3dbinpacking.com/packer/pack");conn=(HttpURLConnection)addr.openConnection();conn.setRequestMethod("POST");conn.setDoOutput(true);conn.connect();OutputStreamWriterosw=newOutputStreamWriter(conn.getOutputStream());// prepare POST bodyStringquery="query="+json.toString();osw.write(query);osw.flush();osw.close();BufferedReaderbr=newBufferedReader(newInputStreamReader(conn.getInputStream()));Stringresponse_json=br.readLine();//DO SOMETHING COOL WITH THE RESPONSESystem.out.println(response_json);}}
API key. You can find the API key in the API Access section after logging in
string
bins
Array of packing spaces parameters
array
items
Array of items parameters. Limit: maximum total number of items per request = 4999
array
params
Array of extra request parameters of extra request parameters
array
Packing spaces array details
Param name
Description
Data type
id
Packing space ID. The number or code you use to identify the packing space.
string
w
Packing space width
integer or float
h
Packing space height
integer or float
d
Packing space depth/length
integer or float
max_wg
The maximum weight that this packing space can hold. Value set to '0' (zero) means there is no weight limit
integer or float
Items array details
Param name
Description
Data type
Info
id
Item ID/SKU. The number or code you use to identify what is being packed.
string
w
The width of the item
integer or float
h
The height of the item
integer or float
d
The depth or length of the item
integer or float
wg
The weight of the item
integer or float
vr
Vertical rotation. The information if the item can be rotated vertically.
integer
q
The amount of the same items to pack
integer
item_colors_schema
Define which kind of color schema should be used
string
Available values: default - colors set in the following parameters will be used 'images_item_border_color' and 'images_bin_fill_color', random - x, item - x
item_fill_color
Item fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
Optional parameters
Param name
Description
Data type
Info
images_width
Max. width of generated images
integer
Available values: 1 - 250
images_height
Max. height of generated images
integer
Available values: 1 - 250
images_background_color
Background color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color
Packing space border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color
Packing space front border color (dashed)
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color
Packing space fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color
Fill color of the last item on images showing a packing process 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color
Border color of the last item on images showing packing 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format
Images format
string
Available values: [ png , svg ]
images_sbs
Generate images showing a packing process 'step-by-step'
integer
Available values: 0 [default] - means that images showing a packing process 'step-by-step' will not be generated, 1 - means that images showing a packing process 'step-by-step' will be generated
images_complete
Generate images showing a final packing result
integer
Available values: 0 [default] - means that images showing final packing result will not be generated, 1 - means that images showing final packing result will be generated
images_separated
Generate images showing the placement of each item separately
integer
Available values: 0 [default] - means that images showing the placement of each item separately will not be generated, 1 - means that images showing the placement of each item separately will be generated
item_coordinates
Return coordinates (x, y, z) for each item
integer
Available values: 0 [default] - means that coordinates of the placement of each item will not be returned, 1 - that coordinates of the placement of each item will be returned
stats
Return the statistics of a packing process (e.g. images generation time)
integer
Available values: 0 [default] - means that the statistics of a packing process will not be returned, 1 - means that the statistics of a packing process will be returned
Response parameters
Param name
Description
Data type
Info
bins_packed
List of packed items
array
errors
List of possible errors that may occur in request
array
Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status
Response status
integer
Possible returned values: 1 - response hasn't included critical errors, 0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
not_packed_items
Items containing incorrect parameters
array
response_time
Server response time
float
Pack a Shipment
Use Pack a Shipment tool to optimize your packing - by number of boxes, space utilization or cost.
packagejavaapplication1;importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStreamWriter;importjava.net.HttpURLConnection;importjava.net.MalformedURLException;importjava.net.ProtocolException;importjava.net.URL;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;;importorg.json.simple.JSONObject;importorg.springframework.web.client.RestTemplate;publicclassJavaApplication1{/**
* @param args the command line arguments
*/publicstaticvoidmain(String[]args)throwsMalformedURLException,ProtocolException,IOException{RestTemplaterestTemplate=newRestTemplate();JSONObjectjson=newJSONObject();//SET BINSList<Map<String,String>>bins=newArrayList<Map<String,String>>();Map<String,String>bin1=newHashMap<String,String>();bin1.put("id","Pack M");bin1.put("h","4");bin1.put("w","4");bin1.put("d","4");bin1.put("wg","");bin1.put("max_wg","");bins.add(bin1);Map<String,String>bin2=newHashMap<String,String>();bin2.put("id","Pack S");bin2.put("h","3");bin2.put("w","3");bin2.put("d","6");bin2.put("wg","");bin2.put("max_wg","");bins.add(bin2);//SET ITEMSList<Map<String,String>>items=newArrayList<Map<String,String>>();Map<String,String>item1=newHashMap<String,String>();item1.put("id","Speakers");item1.put("w","3");item1.put("h","3");item1.put("d","3");item1.put("wg","2");item1.put("q","3");item1.put("vr","1");items.add(item1);Map<String,String>item2=newHashMap<String,String>();item2.put("id","Bigger item");item2.put("w","3");item2.put("h","3");item2.put("d","5");item2.put("wg","1");item2.put("q","2");item2.put("vr","1");items.add(item2);//SET PARAMETERSMap<String,String>params=newHashMap<String,String>();params.put("images_background_color","255,255,255")params.put("images_bin_border_color","59,59,59")params.put("images_bin_fill_color","230,230,230")params.put("images_item_border_color","22,22,22")params.put("images_item_fill_color","255,193,6")params.put("images_item_back_border_color","22,22,22")params.put("images_sbs_last_item_fill_color","177,14,14")params.put("images_sbs_last_item_border_color","22,22,22")params.put("images_format","svg")params.put("images_width","50")params.put("images_height","50")params.put("images_source","file")params.put("stats","0")params.put("item_coordinates","1")params.put("images_complete","1")params.put("images_sbs","1")params.put("images_separated","0")params.put("optimization_mode","bins_number")//ADD ELEMENTS TO JSONjson.put("username","YOUR_USERNAME");json.put("api_key","YOUR_API_KEY");json.put("items",items);json.put("bins",bins);json.put("params",params);//CALL QUERYHttpURLConnectionconn;URLaddr=newURL("https://global-api.3dbinpacking.com/packer/packIntoMany");conn=(HttpURLConnection)addr.openConnection();conn.setRequestMethod("POST");conn.setDoOutput(true);conn.connect();OutputStreamWriterosw=newOutputStreamWriter(conn.getOutputStream());// prepare POST bodyStringquery="query="+json.toString();osw.write(query);osw.flush();osw.close();BufferedReaderbr=newBufferedReader(newInputStreamReader(conn.getInputStream()));Stringresponse_json=br.readLine();//DO SOMETHING COOL WITH THE RESPONSESystem.out.println(response_json);}}
API key. You can find the API key in the API Access section after logging in
string
bins
Array of packing spaces parameters
array
items
Array of items parameters. Limit: maximum total number of items per request = 4999
array
params
Array of extra request parameters of extra request parameters
array
Packing spaces array details
Param name
Description
Data type
id
Packing space ID. The number or code you use to identify the packing space.
string
w
Packing space width
integer or float
h
Packing space height
integer or float
d
Packing space depth/length
integer or float
max_wg
The maximum weight that this packing space can hold. Value set to '0' (zero) means there is no weight limit
integer or float
Items array details
Param name
Description
Data type
Info
id
Item ID/SKU. The number or code you use to identify what is being packed.
string
w
The width of the item
integer or float
h
The height of the item
integer or float
d
The depth or length of the item
integer or float
wg
The weight of the item
integer or float
vr
Vertical rotation. The information if the item can be rotated vertically.
integer
Vertical rotation. The information if the item can be rotated vertically.
q
The amount of the same items to pack
integer
group
Grouped items are packed together, which enables to separate e.g. food products (group 'X') from domestic detergents (group 'Y').
string
separate
Items separation; Parameter set to '1' means that given items cannot be packed together with other items
integer
Available values: 1 - means that items will be separated, 0 [default] - means that items will not be separated
limit_per_bin
Define how many items can be packed in one packing space
integer
acceptable_bins
Define which packing spaces can be used to pack items. If the parameter is not set, then all packing spaces can be used. Given values have to contain packing spaces ID included in 'bins' parameter.
array
item_colors_schema
Define which kind of color schema should be used
string
Available values: default - colors set in the following parameters will be used 'images_item_border_color' and 'images_bin_fill_color', random - x, item - x
item_fill_color
Item fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
Optional parameters
Param name
Description
Data type
Info
optimization_mode
Define a packing optimisation method
string
Available values: bins_number [default] - the smallest possible number of packing spaces; bins_utilization - max. utilization inside packing spaces; cost - the lowest cost of shipment or transport ('cost' parameter is required to be given for every packing space)
images_width
Max. width of generated images
integer
Available values: 1 - 250
images_height
Max. height of generated images
integer
Available values: 1 - 250
images_background_color
Background color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color
Packing space border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color
Packing space front border color (dashed)
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color
Packing space fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color
Fill color of the last item on images showing a packing process 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color
Border color of the last item on images showing packing 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format
Images format
string
Available values: [ png , svg ]
images_sbs
Generate images showing a packing process 'step-by-step'
integer
Available values: 0 [default] - means that images showing a packing process 'step-by-step' will not be generated, 1 - means that images showing a packing process 'step-by-step' will be generated
images_complete
Generate images showing a final packing result
integer
Available values: 0 [default] - means that images showing final packing result will not be generated, 1 - means that images showing final packing result will be generated
images_separated
Generate images showing the placement of each item separately
integer
Available values: 0 [default] - means that images showing the placement of each item separately will not be generated, 1 - means that images showing the placement of each item separately will be generated
item_coordinates
Return coordinates (x, y, z) for each item
integer
Available values: 0 [default] - means that coordinates of the placement of each item will not be returned, 1 - that coordinates of the placement of each item will be returned
stats
Return the statistics of a packing process (e.g. images generation time)
integer
Available values: 0 [default] - means that the statistics of a packing process will not be returned, 1 - means that the statistics of a packing process will be returned
Response parameters
Param name
Description
Data type
Info
bins_packed
List of packed items
array
errors
List of possible errors that may occur in request
array
Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status
Response status
integer
Possible returned values: 1 - response hasn't included critical errors, 0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
not_packed_items
Items containing incorrect parameters
array
response_time
Server response time
float
Stack Pallets
Use Stack Pallets tool to optimize how you pack your pallets and reduce their number for transport and storage.
API key. You can find the API key in the API Access section after logging in
string
pallet
Array of pallet parameters
array
items
Array of items parameters. Limit: maximum total number of items per request = 4999
array
params
Array of extra request parameters
array
Pallet array details
Param name
Description
Data type
id
Pallet ID. A pallet you want to stack your items onto
string
w
Pallet width
integer or float
h
Pallet height
integer or float
d
Pallet depth/length
integer or float
Items array details
Param name
Description
Data type
Info
id
Item ID/SKU. The number or code you use to identify what is being packed.
string
w
The width of the item
integer or float
h
The height of the item
integer or float
d
The depth or length of the item
integer or float
wg
The weight of the item
integer or float
vr
Vertical rotation. The information if the item can be rotated vertically.
integer
Vertical rotation. The information if the item can be rotated vertically.
q
The amount of the same items to pack
integer
item_colors_schema
Define which kind of color schema should be used
string
item_fill_color
Item fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
Optional parameters
Param name
Description
Data type
Info
images_width
Max. width of generated images
integer
Available values: 1 - 250
images_height
Max. height of generated images
integer
Available values: 1 - 250
images_background_color
Background color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color
Packing space border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color
Packing space front border color (dashed)
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color
Packing space fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color
Fill color of the last item on images showing a packing process 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color
Border color of the last item on images showing packing 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format
Images format
string
Available values: [ png , svg ]
images_sbs
Generate images showing a packing process 'step-by-step'
integer
Available values: 0 [default] - means that images showing a packing process 'step-by-step' will not be generated, 1 - means that images showing a packing process 'step-by-step' will be generated
images_complete
Generate images showing a final packing result
integer
Available values: 0 [default] - means that images showing final packing result will not be generated, 1 - means that images showing final packing result will be generated
images_separated
Generate images showing the placement of each item separately
integer
Available values: 0 [default] - means that images showing the placement of each item separately will not be generated, 1 - means that images showing the placement of each item separately will be generated
item_coordinates
Return coordinates (x, y, z) for each item
integer
Available values: 0 [default] - means that coordinates of the placement of each item will not be returned, 1 - that coordinates of the placement of each item will be returned
stats
Return the statistics of a packing process (e.g. images generation time)
integer
Available values: 0 [default] - means that the statistics of a packing process will not be returned, 1 - means that the statistics of a packing process will be returned
Response parameters
Param name
Description
Data type
Info
bins_packed
List of packed items
array
errors
List of possible errors that may occur in request
array
Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status
Response status
integer
Possible returned values: 1 - response hasn't included critical errors, 0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
not_packed_items
Items containing incorrect parameters
array
response_time
Server response time
float
Find a Missing Dimension
Use Find a Missing Dimension tool to calculate measurements and the area your packing will use.
packagejavaapplication1;importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStreamWriter;importjava.net.HttpURLConnection;importjava.net.MalformedURLException;importjava.net.ProtocolException;importjava.net.URL;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;;importorg.json.simple.JSONObject;importorg.springframework.web.client.RestTemplate;publicclassJavaApplication1{/**
* @param args the command line arguments
*/publicstaticvoidmain(String[]args)throwsMalformedURLException,ProtocolException,IOException{RestTemplaterestTemplate=newRestTemplate();JSONObjectjson=newJSONObject();//SET BINSList<Map<String,String>>bins=newArrayList<Map<String,String>>();Map<String,String>bin1=newHashMap<String,String>();bin1.put("id","Pack M");bin1.put("h","4");bin1.put("w","4");bin1.put("d","4");bin1.put("wg","");bin1.put("max_wg","");bins.add(bin1);Map<String,String>bin2=newHashMap<String,String>();bin2.put("id","Pack S");bin2.put("h","3");bin2.put("w","3");bin2.put("d","6");bin2.put("wg","");bin2.put("max_wg","");bins.add(bin2);//SET ITEMSList<Map<String,String>>items=newArrayList<Map<String,String>>();Map<String,String>item1=newHashMap<String,String>();item1.put("id","Speakers");item1.put("w","3");item1.put("h","3");item1.put("d","3");item1.put("wg","2");item1.put("q","3");item1.put("vr","1");items.add(item1);Map<String,String>item2=newHashMap<String,String>();item2.put("id","Bigger item");item2.put("w","3");item2.put("h","3");item2.put("d","5");item2.put("wg","1");item2.put("q","2");item2.put("vr","1");items.add(item2);//SET PARAMETERSMap<String,String>params=newHashMap<String,String>();params.put("images_background_color","255,255,255")params.put("images_bin_border_color","59,59,59")params.put("images_bin_fill_color","230,230,230")params.put("images_item_border_color","22,22,22")params.put("images_item_fill_color","255,193,6")params.put("images_item_back_border_color","22,22,22")params.put("images_sbs_last_item_fill_color","177,14,14")params.put("images_sbs_last_item_border_color","22,22,22")params.put("images_format","svg")params.put("images_width","50")params.put("images_height","50")params.put("images_source","file")params.put("stats","0")params.put("item_coordinates","1")params.put("images_complete","1")params.put("images_sbs","1")params.put("images_separated","0")//ADD ELEMENTS TO JSONjson.put("username","YOUR_USERNAME");json.put("api_key","YOUR_API_KEY");json.put("items",items);json.put("bins",bins);json.put("params",params);//CALL QUERYHttpURLConnectionconn;URLaddr=newURL("https://global-api.3dbinpacking.com/packer/findSmallestBin");conn=(HttpURLConnection)addr.openConnection();conn.setRequestMethod("POST");conn.setDoOutput(true);conn.connect();OutputStreamWriterosw=newOutputStreamWriter(conn.getOutputStream());// prepare POST bodyStringquery="query="+json.toString();osw.write(query);osw.flush();osw.close();BufferedReaderbr=newBufferedReader(newInputStreamReader(conn.getInputStream()));Stringresponse_json=br.readLine();//DO SOMETHING COOL WITH THE RESPONSESystem.out.println(response_json);}}
API key. You can find the API key in the API Access section after logging in
string
bins
Array of packing spaces parameters
array
items
Array of items parameters. Limit: maximum total number of items per request = 4999
array
params
Array of extra request parameters
array
Packing spaces array details
Param name
Description
Data type
id
Packing space ID. The number or code you use to identify the packing space.
string
w
Packing space width
float
h
Packing space height
float
d
Packing space depth/length
float
Items array details
Param name
Description
Data type
Info
id
Item ID/SKU. The number or code you use to identify what is being packed.
string
w
The width of the item
integer or float
h
The height of the item
integer or float
d
The depth or length of the item
integer or float
wg
The weight of the item
integer or float
vr
Vertical rotation. The information if the item can be rotated vertically.
integer
Vertical rotation. The information if the item can be rotated vertically.
q
The amount of the same items to pack
integer
acceptable_bins
Define which packing spaces can be used to pack items. If the parameter is not set, then all packing spaces can be used. Given values have to contain packing spaces ID included in 'bins' parameter.
array
item_colors_schema
Define which kind of color schema should be used
string
Available values: default - colors set in the following parameters will be used 'images_item_border_color' and 'images_bin_fill_color', random - x, item - x
item_fill_color
Item fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
Optional parameters
Param name
Description
Data type
Info
images_width
Max. width of generated images
integer
Available values: 1 - 250
images_height
Max. height of generated images
integer
Available values: 1 - 250
images_background_color
Background color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color
Packing space border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color
Packing space front border color (dashed)
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color
Packing space fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color
Fill color of the last item on images showing a packing process 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color
Border color of the last item on images showing packing 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format
Images format
string
Available values: [ png , svg ]
images_sbs
Generate images showing a packing process 'step-by-step'
integer
Available values: 0 [default] - means that images showing a packing process 'step-by-step' will not be generated, 1 - means that images showing a packing process 'step-by-step' will be generated
images_complete
Generate images showing a final packing result
integer
Available values: 0 [default] - means that images showing final packing result will not be generated, 1 - means that images showing final packing result will be generated
images_separated
Generate images showing the placement of each item separately
integer
Available values: 0 [default] - means that images showing the placement of each item separately will not be generated, 1 - means that images showing the placement of each item separately will be generated
item_coordinates
Return coordinates (x, y, z) for each item
integer
Available values: 0 [default] - means that coordinates of the placement of each item will not be returned, 1 - that coordinates of the placement of each item will be returned
stats
Return the statistics of a packing process (e.g. images generation time)
integer
Available values: 0 [default] - means that the statistics of a packing process will not be returned, 1 - means that the statistics of a packing process will be returned
Response parameters
Param name
Description
Data type
Info
bins_packed
List of packed items
array
errors
List of possible errors that may occur in request
array
Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status
Response status
integer
Possible returned values: 1 - response hasn't included critical errors, 0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
not_packed_items
Items containing incorrect parameters
array
response_time
Server response time
float
Find a Box Size
Use Find a Box Size tool to maximize the use of space and calculate the right-sized box for your packing.
packagejavaapplication1;importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStreamWriter;importjava.net.HttpURLConnection;importjava.net.MalformedURLException;importjava.net.ProtocolException;importjava.net.URL;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;;importorg.json.simple.JSONObject;importorg.springframework.web.client.RestTemplate;publicclassJavaApplication1{/**
* @param args the command line arguments
*/publicstaticvoidmain(String[]args)throwsMalformedURLException,ProtocolException,IOException{RestTemplaterestTemplate=newRestTemplate();JSONObjectjson=newJSONObject();//SET BINSList<Map<String,String>>bins=newArrayList<Map<String,String>>();Map<String,String>bin1=newHashMap<String,String>();bin1.put("id","Pack M");bin1.put("h","4");bin1.put("w","4");bin1.put("d","4");bin1.put("wg","");bin1.put("max_wg","");bins.add(bin1);Map<String,String>bin2=newHashMap<String,String>();bin2.put("id","Pack S");bin2.put("h","3");bin2.put("w","3");bin2.put("d","6");bin2.put("wg","");bin2.put("max_wg","");bins.add(bin2);//SET ITEMSList<Map<String,String>>items=newArrayList<Map<String,String>>();Map<String,String>item1=newHashMap<String,String>();item1.put("id","Speakers");item1.put("w","3");item1.put("h","3");item1.put("d","3");item1.put("wg","2");item1.put("q","3");item1.put("vr","1");items.add(item1);Map<String,String>item2=newHashMap<String,String>();item2.put("id","Bigger item");item2.put("w","3");item2.put("h","3");item2.put("d","5");item2.put("wg","1");item2.put("q","2");item2.put("vr","1");items.add(item2);//SET PARAMETERSMap<String,String>params=newHashMap<String,String>();params.put("images_background_color","255,255,255")params.put("images_bin_border_color","59,59,59")params.put("images_bin_fill_color","230,230,230")params.put("images_item_border_color","22,22,22")params.put("images_item_fill_color","255,193,6")params.put("images_item_back_border_color","22,22,22")params.put("images_sbs_last_item_fill_color","177,14,14")params.put("images_sbs_last_item_border_color","22,22,22")params.put("images_format","svg")params.put("images_width","50")params.put("images_height","50")params.put("images_source","file")params.put("stats","0")params.put("item_coordinates","1")params.put("images_complete","1")params.put("images_sbs","1")params.put("images_separated","0")//ADD ELEMENTS TO JSONjson.put("username","YOUR_USERNAME");json.put("api_key","YOUR_API_KEY");json.put("items",items);json.put("bins",bins);json.put("params",params);//CALL QUERYHttpURLConnectionconn;URLaddr=newURL("https://global-api.3dbinpacking.com/packer/findBinSize");conn=(HttpURLConnection)addr.openConnection();conn.setRequestMethod("POST");conn.setDoOutput(true);conn.connect();OutputStreamWriterosw=newOutputStreamWriter(conn.getOutputStream());// prepare POST bodyStringquery="query="+json.toString();osw.write(query);osw.flush();osw.close();BufferedReaderbr=newBufferedReader(newInputStreamReader(conn.getInputStream()));Stringresponse_json=br.readLine();//DO SOMETHING COOL WITH THE RESPONSESystem.out.println(response_json);}}
API key. You can find the API key in the API Access section after logging in
string
bins
Array of packing spaces parameters
array
items
Array of items parameters. Limit: maximum total number of items per request = 4999
array
params
Array of extra request parameters
array
| Packing spaces array details
Param name
Description
Data type
id
Packing space ID. The number or code you use to identify the packing space.
string
w
Packing space max. width
float
h
Packing space max. height
float
d
Packing space max. depth/length
float
Items array details
Param name
Description
Data type
Info
id
Item ID/SKU. The number or code you use to identify what is being packed.
string
w
The width of the item
integer or float
h
The height of the item
integer or float
d
The depth or length of the item
integer or float
wg
The weight of the item
integer or float
vr
Vertical rotation. The information if the item can be rotated vertically.
integer
Vertical rotation. The information if the item can be rotated vertically.
q
The amount of the same items to pack
integer
item_colors_schema
Define which kind of color schema should be used
string
item_fill_color
Item fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
Optional parameters
Param name
Description
Data type
Info
images_width
Max. width of generated images
integer
Available values: 1 - 250
images_height
Max. height of generated images
integer
Available values: 1 - 250
images_background_color
Background color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color
Packing space border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color
Packing space front border color (dashed)
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color
Packing space fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color
Fill color of the last item on images showing a packing process 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color
Border color of the last item on images showing packing 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format
Images format
string
Available values: [ png , svg ]
images_sbs
Generate images showing a packing process 'step-by-step'
integer
Available values: 0 [default] - means that images showing a packing process 'step-by-step' will not be generated, 1 - means that images showing a packing process 'step-by-step' will be generated
images_complete
Generate images showing a final packing result
integer
Available values: 0 [default] - means that images showing final packing result will not be generated, 1 - means that images showing final packing result will be generated
images_separated
Generate images showing the placement of each item separately
integer
Available values: 0 [default] - means that images showing the placement of each item separately will not be generated, 1 - means that images showing the placement of each item separately will be generated
item_coordinates
Return coordinates (x, y, z) for each item
integer
Available values: 0 [default] - means that coordinates of the placement of each item will not be returned, 1 - that coordinates of the placement of each item will be returned
stats
Return the statistics of a packing process (e.g. images generation time)
integer
Available values: 0 [default] - means that the statistics of a packing process will not be returned, 1 - means that the statistics of a packing process will be returned
Response parameters
Param name
Description
Data type
Info
bins_packed
List of packed items
array
errors
List of possible errors that may occur in request
array
Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status
Response status
integer
Possible returned values: 1 - response hasn't included critical errors, 0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
not_packed_items
Items containing incorrect parameters
array
response_time
Server response time
float
Check Max Load
Use Check Max Load to Check exactly how many items will fill a box or packing space to capacity.
packagejavaapplication1;importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStreamWriter;importjava.net.HttpURLConnection;importjava.net.MalformedURLException;importjava.net.ProtocolException;importjava.net.URL;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;;importorg.json.simple.JSONObject;importorg.springframework.web.client.RestTemplate;publicclassJavaApplication1{/**
* @param args the command line arguments
*/publicstaticvoidmain(String[]args)throwsMalformedURLException,ProtocolException,IOException{RestTemplaterestTemplate=newRestTemplate();JSONObjectjson=newJSONObject();//SET BINSList<Map<String,String>>bins=newArrayList<Map<String,String>>();Map<String,String>bin1=newHashMap<String,String>();bin1.put("id","Pack M");bin1.put("h","4");bin1.put("w","4");bin1.put("d","4");bin1.put("wg","");bin1.put("max_wg","");bins.add(bin1);Map<String,String>bin2=newHashMap<String,String>();bin2.put("id","Pack S");bin2.put("h","3");bin2.put("w","3");bin2.put("d","6");bin2.put("wg","");bin2.put("max_wg","");bins.add(bin2);//SET ITEMSList<Map<String,String>>items=newArrayList<Map<String,String>>();Map<String,String>item1=newHashMap<String,String>();item1.put("id","Speakers");item1.put("w","3");item1.put("h","3");item1.put("d","3");item1.put("wg","2");item1.put("q","3");item1.put("vr","1");items.add(item1);Map<String,String>item2=newHashMap<String,String>();item2.put("id","Bigger item");item2.put("w","3");item2.put("h","3");item2.put("d","5");item2.put("wg","1");item2.put("q","2");item2.put("vr","1");items.add(item2);//SET PARAMETERSMap<String,String>params=newHashMap<String,String>();params.put("images_background_color","255,255,255")params.put("images_bin_border_color","59,59,59")params.put("images_bin_fill_color","230,230,230")params.put("images_item_border_color","22,22,22")params.put("images_item_fill_color","255,193,6")params.put("images_item_back_border_color","22,22,22")params.put("images_sbs_last_item_fill_color","177,14,14")params.put("images_sbs_last_item_border_color","22,22,22")params.put("images_format","svg")params.put("images_width","50")params.put("images_height","50")params.put("images_source","file")params.put("stats","0")params.put("item_coordinates","1")params.put("images_complete","1")params.put("images_sbs","1")params.put("images_separated","0")//ADD ELEMENTS TO JSONjson.put("username","YOUR_USERNAME");json.put("api_key","YOUR_API_KEY");json.put("items",items);json.put("bins",bins);json.put("params",params);//CALL QUERYHttpURLConnectionconn;URLaddr=newURL("https://global-api.3dbinpacking.com/packer/fillContainer");conn=(HttpURLConnection)addr.openConnection();conn.setRequestMethod("POST");conn.setDoOutput(true);conn.connect();OutputStreamWriterosw=newOutputStreamWriter(conn.getOutputStream());// prepare POST bodyStringquery="query="+json.toString();osw.write(query);osw.flush();osw.close();BufferedReaderbr=newBufferedReader(newInputStreamReader(conn.getInputStream()));Stringresponse_json=br.readLine();//DO SOMETHING COOL WITH THE RESPONSESystem.out.println(response_json);}}
API key. You can find the API key in the API Access section after logging in
string
bins
Array of packing spaces parameters
array
items
Array of items parameters. Limit: maximum total number of items per request = 4999
array
params
Array of extra request parameters
array
Packing spaces array details
Param name
Description
Data type
id
Packing space ID. The number or code you use to identify the packing space.
string
w
Packing space width
float
h
Packing space height
float
d
Packing space depth/length
float
Items array details
Param name
Description
Data type
Info
id
Item ID/SKU. The number or code you use to identify what is being packed.
string
w
The width of the item
integer or float
h
The height of the item
integer or float
d
The depth or length of the item
integer or float
wg
The weight of the item
integer or float
vr
Vertical rotation. The information if the item can be rotated vertically.
integer
Vertical rotation. The information if the item can be rotated vertically.
item_colors_schema
Define which kind of color schema should be used
string
item_fill_color
Item fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
Optional parameters
Param name
Description
Data type
Info
images_width
Max. width of generated images
integer
Available values: 1 - 250
images_height
Max. height of generated images
integer
Available values: 1 - 250
images_background_color
Background color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color
Packing space border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color
Packing space front border color (dashed)
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color
Packing space fill color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color
Item border color
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color
Fill color of the last item on images showing a packing process 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color
Border color of the last item on images showing packing 'step-by-step'
string
Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format
Images format
string
Available values: [ png , svg ]
images_sbs
Generate images showing a packing process 'step-by-step'
integer
Available values: 0 [default] - means that images showing a packing process 'step-by-step' will not be generated, 1 - means that images showing a packing process 'step-by-step' will be generated
images_complete
Generate images showing a final packing result
integer
Available values: 0 [default] - means that images showing final packing result will not be generated, 1 - means that images showing final packing result will be generated
images_separated
Generate images showing the placement of each item separately
integer
Available values: 0 [default] - means that images showing the placement of each item separately will not be generated, 1 - means that images showing the placement of each item separately will be generated
item_coordinates
Return coordinates (x, y, z) for each item
integer
Available values: 0 [default] - means that images showing the placement of each item separately will not be generated, 1 - means that images showing the placement of each item separately will be generated
stats
Return the statistics of a packing process (e.g. images generation time)
integer
Available values: 0 [default] - means that the statistics of a packing process will not be returned, 1 - means that the statistics of a packing process will be returned
Response parameters
Param name
Description
Data type
Info
bins_packed
List of packed items
array
errors
List of possible errors that may occur in request
array
Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status
Response status
integer
Possible returned values: 1 - response hasn't included critical errors, 0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).