Cookies help in improving the site. You can enable/disable cookies on your browser. For more information on Cookies Policy.

Multi Bin Packing

Description

Algorithm, which aims to chose proper containers to pack given items. Dimensions of items to pack and dimensions of available containers are required to make algorithm find the solution enabling to pack all items in the smallest number of containers.

Use of algorithm (examples)

Example 1:

Packing few containers - option 1

An online shop is in the proccess of executioning the order consisting of three items. As it possesses one type of a container, it needs to check how many containers to use to pack the whole order.

Order details given to our algorithm:
Available containers:

space in a container
of dimensions 12x12x12

Items to pack:

Dimensions: 10x10x10
Quantity: 3

3DBinPacking is making a packing simulation and returns the following result:

One item has been packed

One item has been packed

One item has been packed


Example 2:

Packing few containers - option 2

An online shop is in the proccess of executioning the order consisting of three items. As it possesses various types of containers, it needs to check which of them to use to pack the whole order in the most optimal way.

Order details given to our algorithm:
Available containers:

space in a container
of dimensions 12x12x12

space in a container
of dimensions 24x12x12

Items to pack:

Dimensions: 10x10x10
Quantity: 3

3DBinPacking is making a packing simulation and returns the following result:

24x12x12

2 items have been packed

12x12x12

One item has been packed


Example 3:

Packing few containers - option 3

An online shop is in the proccess of executioning the order consisting of three items. As it possesses various types of containers, it needs to check which of them to use to pack the whole order in the most optimal way.

Order details given to our algorithm:
Available containers:

space in a container
of dimensions 12x12x12

space in a container
of dimensions 24x12x12

space in a container
of dimensions 24x24x24

Items to pack:

Dimensions: 10x10x10
Quantity: 3

3DBinPacking is making a packing simulation and returns the following result:

24x24x24

All 3 items have been packed

Register in our service
Confirm registration by clicking the activation link
in the received email
Log in
Get your API key
Prepare andsend the request
according to the recommendations in the documentation
In the response you will receive calculations
made by our algorithm
  • Register in our service
  • Confirm registration by clicking the activation link
    in the received email
  • Log in
  • Get your API key
  • Prepare andsend the request
    according to the recommendations in the documentation
  • In the response you will receive calculations
    made by our algorithm

Multi Bin Packing

Container

Id
Wdt
Hgt
Dpt
Max. wgt.

Items

Id
Wdt
Hgt
Dpt
Wgt
Qty
VR

Visualization parameters

  • rgb(245,245,245)
  • rgb(161,161,161)
  • rgb(230,230,230)
  • rgb(255,255,255)
  • rgb(227,144,22)
  • rgb(255,255,255)
  • rgb(142,132,122)
  • rgb(102,97,92)

Basic data

SERVERS ADDRESSES

  • us-east.api.3dbinpacking.com/packer/packIntoMany - USA (Virginia)
  • eu.api.3dbinpacking.com/packer/packIntoMany - Europe (Ireland)
  • asia1.api.3dbinpacking.com/packer/packIntoMany - Asia Pacific (Singapore)
  • global-api.3dbinpacking.com/packer/packIntoMany - Global address

AVAILABLE METHODS OF SENDING DATA:

  • POST - Recommended
  • GET

AVAILABLE PROTOCOLES:

  • https - Recommended
  • http

CALL METHODS:

  • as parameter - Example GET: https://global-api.3dbinpacking.com/packer/packIntoMany?query={json_encoded_data}
  • as JSON content request

Request parameters

REQUIRED PARAMETERS

username - User name

  • Data type: string

api_key - API key. You can find it in the user panel after log in

  • Data type: string

bins - Array of containers parameters

  • Data type: array
  • Array keys:
    • w - Container width.

      • Data type: integer or float
    • h - Container height.

      • Data type: integer or float
    • d - Container depth.

      • Data type: integer or float
    • id - Container ID. It enables to identify a particular container in a packing result

      • Data type: string
    • q - Maximum number of containers of given dimensions

      • Data type:
        • - if the value is not set or is set to NULL - it means that the number of containers is indefinite
        • - integer (1,2,etc...) - it means that the number of containers is limited to that value
      • Data type: integer
    • max_wg - Maximum weight of items in a container. Value set to "0" (zero) means there is no weight limit

      • Data type: integer or float
  • Example:
    {"bins":[{"w": "10","h": "10","d": "10","id": "bin1","max_wg": "0","q": null}]}

items - Array of items parameters

  • Data type: array
  • Limit: Maximum total number of items per request = 4999
  • Array keys:
    • w - Item width

      • Data type: integer or float
    • h - Item height

      • Data type: integer or float
    • d - Item depth

      • Data type: integer or float
    • id - Item ID. It enables to identify a particular item in a packing result

      • Data type: string
    • wg - Item weight

      • Data type: integer or float
    • vr - vertical rotation. The information if the item can be rotated vertically

      • Data type: integer
      • Available values:
        • 1 - means that the item can be rotated vertically
        • 0 - means that the item cannot be rotated vertically
    • q - The amount of the same items to pack

      • Data type: integer
    • item_colors_schema - define which kind of color schema should be used

      • Data type: string
      • Available values:
        • default - colors definitions in 'params' section will be used (default value)
        • item - colors from 'item' section will be used
        • random - colors will be generated randomly by the system
    • item_fill_color - Item fill color

      • Data type: 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

      • Data type: string
      • Available values: RGB values of colors dots separated "red,green,blue", allowed values 0-255
      • Example: "255,120,10"
  • Example:
    {"items": [{"w": 5, "h": 5,"d": 5,"q": 2,"vr": 1,"id": "ITEM - 1","wg": 0},{"w": 20,"h": 7,"d": 6,"q": 1,"vr": 1,"id": "ITEM - 2","wg": 0}]}

OPTIONAL PARAMETERS

images_width - Max. width of generated images

  • Data type: integer
  • Available values: 1 -250

images_height - Max. height of generated images

  • Data type: integer
  • Available values: 1 -250

images_background_color - Background color

  • Data type: integer
  • Available values: RGB values of colors dots separated "red,green,blue", allowed values 0-255
  • Example: "255,120,10"

images_bin_border_color - Container border color

  • Data type: integer
  • Available values: RGB values of colors dots separated "red,green,blue", allowed values 0-255
  • Example: "255,120,10"

images_bin_dashed_line_color - Container front border color (dashed)

  • Data type: integer
  • Available values: RGB values of colors dots separated "red,green,blue", allowed values 0-255
  • Example: "255,120,10"

images_bin_fill_color - Container fill color

  • Data type: integer
  • 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

  • Data type: integer
  • 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 packing "step by step"

  • Data type: integer
  • 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"

  • Data type: integer
  • Available values: RGB values of colors dots separated "red,green,blue", allowed values 0-255
  • Example: "255,120,10"

images_format - Images format

  • Data type: string
  • Available values: [ png , svg ]

images_sbs - Generate images showing packing "step by step"

  • Data type: integer
  • Available values:
    • 0 [default] - means that images showing packing "step by step" will not be generated
    • 1 - means that images showing packing "step by step" will be generated

images_complete - Generate images showing final packing result.

  • Data type: 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

  • Data type: 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

  • Data type: 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 stats (eg. images generation time)

  • Data type: integer
  • Available values:
    • 0 [default] - means that stats will not be returned
    • 1 - means that stats will be returned

Response parameters

bins_packed - Lost of packed items

  • Data type: array

errors - The list of possible errors occured in request

  • Data type: array
  • Example: [{'level'}]
  • Possible returned values:
    • "critical" - critical error - disabling packing
    • "warning" - warning about incorrect data in request

status - Response stat

  • Data type: 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. field which should contain number, contains string).

not_packed_items - Items containing incorrect parameres

  • Data type: array

response_time - Server response time.

  • Data type: float

Examples

Request

{"bins":[{"w":5,"h":5,"d":5,"max_wg":0,"id":"Bin1","q":null},{"w":3,"h":3,"d":3,"max_wg":0,"id":"Bin2"}],"items":[{"w":5,"h":3,"d":2,"q":2,"vr":1,"wg":0,"id":"Item1"},{"w":3,"h":3,"d":3,"q":3,"vr":1,"wg":0,"id":"Item2"}],"username":"YOUR_USERNAME","api_key":"YOUR_API_KEY","params":{"images_background_color":"255,255,255","images_bin_border_color":"59,59,59","images_bin_fill_color":"230,230,230","images_item_border_color":"214,79,79","images_item_fill_color":"177,14,14","images_item_back_border_color":"215,103,103","images_sbs_last_item_fill_color":"99,93,93","images_sbs_last_item_border_color":"145,133,133","images_width":100,"images_height":100,"images_source":"file","images_sbs":1,"stats":1,"item_coordinates":1,"images_complete":1,"images_separated":1}}

Response

{"response":{"bins_packed":[{"bin_data":{"w":5,"h":5,"d":5,"id":"Bin1","used_space":69.6,"weight":0,"used_weight":100},"image_complete":"...image_data...","images_generation_time":0.006,"packing_time":0.02697,"items":[{"id":"Item1","image_separated":"...image_data...","image_sbs":"...image_data...","coordinates":{"x1":"0","y1":"0","z1":"0","x2":3,"y2":5,"z2":2}},{"id":"Item2","image_separated":"...image_data...","image_sbs":"...image_data...","coordinates":{"x1":"0","y1":"0","z1":"2","x2":3,"y2":3,"z2":5}},{"id":"Item1","image_separated":"...image_data...","image_sbs":"...image_data...","coordinates":{"x1":"3","y1":"0","z1":"0","x2":5,"y2":5,"z2":3}}]},{"bin_data":{"w":3,"h":3,"d":3,"id":"Bin2","used_space":100},"image_complete":"...image_data...","images_generation_time":0.00269,"packing_time":0.02467,"items":[{"id":"Item2","image_separated":"...image_data...","image_sbs":"...image_data...","coordinates":{"x1":"0","y1":"0","z1":"0","x2":3,"y2":3,"z2":3}}]},{"bin_data":{"w":3,"h":3,"d":3,"id":"Bin2","used_space":100,"weight":0,"used_weight":100},"image_complete":"...image_data...","images_generation_time":0.00259,"packing_time":0.0252,"items":[{"id":"Item2","image_separated":"...image_data...","image_sbs":"...image_data...","coordinates":{"x1":"0","y1":"0","z1":"0","x2":3,"y2":3,"z2":3}}]}],"errors":[],"status":1,"not_packed_items":[],"response_time":0.09721}}

Request

curl -X POST \
-H "Content-Type: application/json" \
-d '{"bins": [{"w": 5, "h": 5, "d": 5, "max_wg": 0, "id": "Bin1", "q": null},{"w": 3, "h": 3, "d": 3, "max_wg": 0, "id": "Bin2"}], "items": [{"w": 5, "h": 3, "d": 2, "q": 2, "vr": 1, "wg": 0, "id": "Item1"},{"w": 3, "h": 3, "d": 3, "q": 3, "vr": 1, "wg": 0, "id": "Item2"}], "username": "YOUR_USERNAME", "api_key": "YOUR_API_KEY", "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "214,79,79", "images_item_fill_color": "177,14,14", "images_item_back_border_color": "215,103,103", "images_sbs_last_item_fill_color": "99,93,93", "images_sbs_last_item_border_color": "145,133,133", "images_width": 100, "images_height": 100, "images_source": "file", "images_sbs": 1, "stats": 1, "item_coordinates": 1, "images_complete": 1, "images_separated": 1}}' \
https://eu.api.3dbinpacking.com/packer/packIntoMany \
-k
                        

Response

{"response": {"bins_packed": [{"bin_data": {"w": 5, "h": 5, "d": 5, "id": "Bin1", "used_space": 69.6, "weight": 0, "used_weight": 100}, "image_complete": "...image_data...", "images_generation_time": 0.006, "packing_time": 0.02697, "items": [{"id": "Item1", "image_separated": "...image_data...", "image_sbs": "...image_data...", "coordinates": {"x1": "0", "y1": "0", "z1": "0", "x2": 3, "y2": 5, "z2": 2}},{"id": "Item2", "image_separated": "...image_data...", "image_sbs": "...image_data...", "coordinates": {"x1": "0", "y1": "0", "z1": "2", "x2": 3, "y2": 3, "z2": 5}},{"id": "Item1", "image_separated": "...image_data...", "image_sbs": "...image_data...", "coordinates": {"x1": "3", "y1": "0", "z1": "0", "x2": 5, "y2": 5, "z2": 3}}]},{"bin_data": {"w": 3, "h": 3, "d": 3, "id": "Bin2", "used_space": 100}, "image_complete": "...image_data...", "images_generation_time": 0.00269, "packing_time": 0.02467, "items": [{"id": "Item2", "image_separated": "...image_data...", "image_sbs": "...image_data...", "coordinates": {"x1": "0", "y1": "0", "z1": "0", "x2": 3, "y2": 3, "z2": 3}}]},{"bin_data": {"w": 3, "h": 3, "d": 3, "id": "Bin2", "used_space": 100, "weight": 0, "used_weight": 100}, "image_complete": "...image_data...", "images_generation_time": 0.00259, "packing_time": 0.0252, "items": [{"id": "Item2", "image_separated": "...image_data...", "image_sbs": "...image_data...", "coordinates": {"x1": "0", "y1": "0", "z1": "0", "x2": 3, "y2": 3, "z2": 3}}]}], "errors": [], "status": 1, "not_packed_items": [], "response_time": 0.09721}}
                        $data = array(
                                    'bins' => array(
                                                    array(
                                                            'w' => '5', 
                                                            'h' => '5', 
                                                            'd' => '5', 
                                                            'max_wg' => '0', 
                                                            'id' => 'Bin1', 
                                                            'q' => '' 
                                                        ), 
                                                    array(
                                                            'w' => '3', 
                                                            'h' => '3', 
                                                            'd' => '3', 
                                                            'max_wg' => '0', 
                                                            'id' => 'Bin2' 
                                                        ) 
                                                ),
                                    'items' => array(
                                                    array(
                                                            'w' => '5', 
                                                            'h' => '3', 
                                                            'd' => '2', 
                                                            'q' => '2', 
                                                            'vr' => '1', 
                                                            'wg' => '0', 
                                                            'id' => 'Item1' 
                                                        ), 
                                                    array(
                                                            'w' => '3', 
                                                            'h' => '3', 
                                                            'd' => '3', 
                                                            'q' => '3', 
                                                            'vr' => '1', 
                                                            'wg' => '0', 
                                                            'id' => 'Item2' 
                                                        ) 
                                                ),
                                    'username' => 'YOUR_USERNAME', 
                                    'api_key' => 'YOUR_API_KEY',
                                    'params' => array(
                                                    'images_background_color' => '255,255,255', 
                                                    'images_bin_border_color' => '59,59,59', 
                                                    'images_bin_fill_color' => '230,230,230', 
                                                    'images_item_border_color' => '214,79,79', 
                                                    'images_item_fill_color' => '177,14,14', 
                                                    'images_item_back_border_color' => '215,103,103', 
                                                    'images_sbs_last_item_fill_color' => '99,93,93', 
                                                    'images_sbs_last_item_border_color' => '145,133,133', 
                                                    'images_width' => '100', 
                                                    'images_height' => '100', 
                                                    'images_source' => 'file', 
                                                    'images_sbs' => '1', 
                                                    'stats' => '1', 
                                                    'item_coordinates' => '1', 
                                                    'images_complete' => '1', 
                                                    'images_separated' => '1' 
                                                )
                        );
                        $query = json_encode($data);
                        
                        $url = "http://eu.api.3dbinpacking.com/packer/packIntoMany";
                        $prepared_query = 'query='.$query;
                        $ch = curl_init($url);
                        curl_setopt( $ch, CURLOPT_POST, true );
                        curl_setopt( $ch, CURLOPT_POSTFIELDS, $prepared_query );
                        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
                        curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
                        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
                        $resp = curl_exec($ch);
                        if (curl_errno($ch)) {
                            echo 'Error #' . curl_errno($ch) . ': ' . curl_error($ch).'<br>';
                        }
                        curl_close($ch);

                        $response = json_decode($resp,true);
                        // display errors
                        if(isset($response['response']['errors'])){
                          foreach($response['response']['errors'] as $error){
                            echo $error['message'].'<br>';
                          }
                        }
                        // display data
                        if( $response['response']['status'] > -1 ){
                          $b_packed= $response['response']['bins_packed'];
                          foreach ($b_packed as $bin){
                              echo "<h2>Bin id:{$bin['bin_data']['id']}</h2> 
                                <p> {$bin['bin_data']['w']} x {$bin['bin_data']['h']} x {$bin['bin_data']['d']}</p>
                                <p> Weight:{$bin['bin_data']['weight']}</p>
                                <p> Used weight:{ $bin['bin_data']['used_weight'] }</p>  
                                <img src=\"{$bin['image_complete']}\">
                                <h2>Items packed in this bin:</h2>";
                              $items = $bin['items'];
                              echo '<table style="text-align: center">
                                <tr><th>Item id</th>
                                    <th>Item dimensions</th>
                                    <th>Item weight</th>
                                    <th>Separated item</th>
                                    <th>Step by step</th></tr>';
                              foreach ( $items as $item){
                              echo "<tr><td>{$item['id']}</td>       
                                        <td> {$item['w']} x {$item['h']} x {$bin['bin_data']['d']}</td>
                                        <td> {$item['wg']}</td>
                                        <td><img src=\"{$item['image_separated']}\"></td>
                                        <td><img src=\"{$item['image_sbs']}\"></td>
                                    </tr>";
                              }    
                              echo '</table>';
                              echo '<hr>'; 

                          }
                        }
                        
                        #!/usr/bin/python
 
                        import httplib
                        import urllib
                        import json

                        conn = httplib.HTTPConnection(host='eu.api.3dbinpacking.com', port=80)
                        data = {"bins": [{"w": 5, "h": 5, "d": 5, "max_wg": 0, "id": "Bin1", "q": null},{"w": 3, "h": 3, "d": 3, "max_wg": 0, "id": "Bin2"}], "items": [{"w": 5, "h": 3, "d": 2, "q": 2, "vr": 1, "wg": 0, "id": "Item1"},{"w": 3, "h": 3, "d": 3, "q": 3, "vr": 1, "wg": 0, "id": "Item2"}], "username": "YOUR_USERNAME", "api_key": "YOUR_API_KEY", "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "214,79,79", "images_item_fill_color": "177,14,14", "images_item_back_border_color": "215,103,103", "images_sbs_last_item_fill_color": "99,93,93", "images_sbs_last_item_border_color": "145,133,133", "images_width": 100, "images_height": 100, "images_source": "file", "images_sbs": 1, "stats": 1, "item_coordinates": 1, "images_complete": 1, "images_separated": 1}}

                        params =  urllib.urlencode( {'query':json.dumps(data)} )
                        headers = {"Content-type": "application/x-www-form-urlencoded", 
                            "Accept": "text/plain"}
                        conn.request( "POST", "/packer/packIntoMany", params, headers )
                        content = conn.getresponse( ).read( )
                        conn.close( )
                        print content
                        
                        package javaapplication1;
 
                        import java.io.BufferedReader;
                        import java.io.IOException;
                        import java.io.InputStreamReader;
                        import java.io.OutputStreamWriter;
                        import java.net.HttpURLConnection;
                        import java.net.MalformedURLException;
                        import java.net.ProtocolException;
                        import java.net.URL;
                        import java.util.ArrayList;
                        import java.util.HashMap;
                        import java.util.List;
                        import java.util.Map;;
                        import org.json.simple.JSONObject;
                        import org.springframework.web.client.RestTemplate;

                        public class JavaApplication1 {

                            /**
                             * @param args the command line arguments
                             */
                            public static void main(String[] args) throws MalformedURLException, ProtocolException, IOException {
                                RestTemplate restTemplate = new RestTemplate();
                                JSONObject json = new JSONObject();

                                //SET BINS
                                List<Map<String , String>> bins  = new ArrayList<Map<String,String>>();

                                Map<String, String> bin1 = new HashMap<String, String>();
                                bin1.put("w", "5");
                                bin1.put("h", "5");
                                bin1.put("d", "5");
                                bin1.put("max_wg", "0");
                                bin1.put("id", "Bin1");
                                bin1.put("q", "");
                                bins.add(bin1);
                                Map<String, String> bin2 = new HashMap<String, String>();
                                bin2.put("w", "3");
                                bin2.put("h", "3");
                                bin2.put("d", "3");
                                bin2.put("max_wg", "0");
                                bin2.put("id", "Bin2");
                                bins.add(bin2);
                                
                                //SET ITEMS
                                List<Map<String , String>> items  = new ArrayList<Map<String,String>>();
                                Map<String, String> item1 = new HashMap<String, String>();
                                item1.put("w", "5");
                                item1.put("h", "3");
                                item1.put("d", "2");
                                item1.put("q", "2");
                                item1.put("vr", "1");
                                item1.put("wg", "0");
                                item1.put("id", "Item1");
                                items.add(item1);
                                Map<String, String> item2 = new HashMap<String, String>();
                                item2.put("w", "3");
                                item2.put("h", "3");
                                item2.put("d", "3");
                                item2.put("q", "3");
                                item2.put("vr", "1");
                                item2.put("wg", "0");
                                item2.put("id", "Item2");
                                items.add(item2);
                                
                                //SET PARAMETERS
                                Map <String , String > params  = new HashMap <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", "214,79,79")
                                params.put("images_item_fill_color", "177,14,14")
                                params.put("images_item_back_border_color", "215,103,103")
                                params.put("images_sbs_last_item_fill_color", "99,93,93")
                                params.put("images_sbs_last_item_border_color", "145,133,133")
                                params.put("images_width", "100")
                                params.put("images_height", "100")
                                params.put("images_source", "file")
                                params.put("images_sbs", "1")
                                params.put("stats", "1")
                                params.put("item_coordinates", "1")
                                params.put("images_complete", "1")
                                params.put("images_separated", "1")
                                
                                //ADD ELEMENTS TO JSON
                                json.put("username", "YOUR_USERNAME");
                                json.put("api_key", "YOUR_API_KEY");
                                json.put("items", items);
                                json.put("bins", bins);
                                json.put("params", params);

                                //CALL QUERY
                                HttpURLConnection conn;
                                URL addr = new URL("http://eu.api.3dbinpacking.com/packer/packIntoMany");
                                conn = (HttpURLConnection) addr.openConnection();
                                conn.setRequestMethod("POST");
                                conn.setDoOutput(true);
                                conn.connect();
                                OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());

                                // prepare POST body 
                                String query = "query=" + json.toString();

                                osw.write(query);
                                osw.flush();
                                osw.close();

                                BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                                String response_json = br.readLine();

                                //DO SOMETHING COOL WITH THE RESPONSE
                                System.out.println(response_json);
                            }
                        }
                        
                        string data;
                        System.Net.HttpWebRequest req = System.Net.WebRequest.Create("https://eu.api.3dbinpacking.com/packer/packIntoMany") as System.Net.HttpWebRequest;

                        var request_data = new {username = "YOUR_USERNAME",
                                                api_key = "YOUR_API_KEY",
                                                items = new[] {
                                                                new { w = "5", h = "3", d = "2", q = "2", vr = "1", wg = "0", id = "Item1"}, 
                                                                new { w = "3", h = "3", d = "3", q = "3", vr = "1", wg = "0", id = "Item2"} 
                                                                },
                                                bins = new[] { 
                                                                new { w = "5", h = "5", d = "5", max_wg = "0", id = "Bin1", q = ""},
                                                                new { w = "3", h = "3", d = "3", max_wg = "0", id = "Bin2"}
                                                                },
                                                @params = new { images_background_color = "255,255,255", 
                                                               images_bin_border_color = "59,59,59", 
                                                               images_bin_fill_color = "230,230,230", 
                                                               images_item_border_color = "214,79,79", 
                                                               images_item_fill_color = "177,14,14", 
                                                               images_item_back_border_color = "215,103,103", 
                                                               images_sbs_last_item_fill_color = "99,93,93", 
                                                               images_sbs_last_item_border_color = "145,133,133", 
                                                               images_width = "100", 
                                                               images_height = "100", 
                                                               images_source = "file", 
                                                               images_sbs = "1", 
                                                               stats = "1", 
                                                               item_coordinates = "1", 
                                                               images_complete = "1", 
                                                               images_separated = "1"
                                                               }
                                            };

                        string json_str = JsonConvert.SerializeObject(request_data);

                        string queryParam = "query="+json_str;

                        byte[] postBytes = System.Text.Encoding.ASCII.GetBytes(queryParam);
                        req.Method = "POST";
                        req.ContentType = "application/x-www-form-urlencoded";
                        req.ContentLength = postBytes.Length;

                        System.IO.Stream postStream = req.GetRequestStream();
                        postStream.Write(postBytes, 0, postBytes.Length);
                        postStream.Close();

                        X509Certificate Cert = X509Certificate2.CreateFromCertFile("path_to_pem_key\eu.api.3dbinpacking.com.pem");
                        req.ClientCertificates.Add(Cert);

                        using (System.Net.HttpWebResponse response = req.GetResponse() as System.Net.HttpWebResponse)
                        {
                            System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
                            data = reader.ReadToEnd();
                        }