How to: Create a Container

For information about prerequisites, see Creating Containers.

To create a Container, you call the Create Container endpoint and pass a Container Type as a path parameter in the endpoint call. Create Container does not have any required members in the request body, meaning that you can create a Container and update its Attributes later by calling the Update Container endpoint.

For the purpose of this how-to and containerization example, we show how to create a pallet that a is non-leaf container, which can contain other containers, and a leaf container that can be containerized.

To create the non-leaf pallet Container, call the Create Container endpoint and pass a Container Type as a path parameter. For this example, we used the Container ID shown in the How to: Create a Container Type topic, container:9b83fc9f-decd-4a8d-a6d1-2b496df0a1a5.

Your request body should be similar to the following:

{
  "trackingDetails": [
    {
      "operator": "worldlogistics",
      "trackingId": "132121232423200"
    }
  ]
}

The response will look similar to the following and returns the Container ID as id in the data object:

{
    "request": {
        "uri": "/core/api/v1/containers/pallet",
        "method": "POST",
        "body": {
            "trackingDetails": [
                {
                    "operator": "worldlogistics",
                    "trackingId": "132121232423200"
                }
            ]
        }
    },
    "data": {
        "id": "pallettwo:d5dcbb09-91e7-47e2-a3ec-9baf5a61b3d2"
    }
}

Leaf containers can be containerized or noncontainerizable. To create Containerizable containers, you must specify the isContainerizable attribute in the response body and set it to true.

To create the leaf box Container, call the Create Container endpoint and pass a Container Type as a path parameter. For this example, we used the Container ID shown in the How to: Create a Container Type topic, container:582d435d-5af1-4442-a095-e9b729ff4020.

Your request body, should look similar to the following:

{
  "trackingDetails": [
    {
      "operator": "worldlogistics",
      "trackingId": "132121232423232"
    }
  ],
  "items": [
    {
      "name": "pant/shirt",
      "code": "ps0001",
      "cost": {
        "unit": {
          "amount": 10.00,
          "currency": "us"
        },
        "total": {
          "amount": 100.00,
          "currency": "us"
        }
      }
    },
   “isContainerizable“ : true
  ]
}

The response will look similar to the following and returns the Container ID as id in the data object:

{
    "request": {
        "uri": "/core/api/v1/containers/boxtwo",
        "method": "POST",
        "body": {
            "trackingDetails": [
                {
                    "operator": "worldlogistics",
                    "trackingId": "132121232423232"
                }
            ],
            "items": [
                {
                    "name": "pant/shirt",
                    "code": "ps0001",
                    "cost": {
                        "unit": {
                            "amount": 10.0,
                            "currency": "us"
                        },
                        "total": {
                            "amount": 100.0,
                            "currency": "us"
                        }
                    }
                }
            ]
        }
    },
    "data": {
        "id": "boxtwo:1a3057a3-fc75-40ed-ac28-989c9d3d1551"
    }
}