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 parameters 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",
"isPrimary": false
}
]
}
The response will look similar to the following and returns the Container ID as id
in the data
object:
{
"data": {
"id": "pallet:de962de0-c0dd-531f-8d9b-7919f0d8c27b"
},
"request": {
"uri": "/core/api/v2/containers/pallet",
"method": "POST",
"queryString": "{}",
"body": {
"trackingDetails": [
{
"operator": "world-logistics",
"trackingId": "432121232423200",
"isPrimary": true
}
],
"isHazmat": false,
"isContainerizable": true,
"isReusable": false
}
}
}
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": "432121232423232"
}
],
"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:
{
"data": {
"id": "boxtwo:11dafb08-f309-5b1d-8d31-7761a75c99ee"
},
"request": {
"uri": "/core/api/v2/containers/boxtwo",
"method": "POST",
"queryString": "{}",
"body": {
"trackingDetails": [
{
"operator": "worldlogistics",
"trackingId": "432121232423232",
"isPrimary": true
}
],
"items": [
{
"name": "pant/shirt",
"code": "ps0001",
"cost": {
"unit": {
"amount": 10,
"currency": "us"
},
"total": {
"amount": 100,
"currency": "us"
}
}
}
],
"isContainerizable": true,
"isHazmat": false,
"isReusable": false
}
}
}
Updated 11 days ago