Container

Introduction to Containers

In the context of logistics, a Container is a physical component with a unique ID. It is the smallest entity unit to represent a shipment. In other words, a Container is an identifier of one or more physical boxes (or items), including the Containers themselves.

All physical items within a Container are identified by their individual scannable IDs externally but they all also share the Container’s scannable ID. Every Container has its own lifecycle and set of Attributes.

The process of grouping multiple Containers together into one Container is called containerization; the opposite of this is de-containerization.

In the event that a Container is added to another Container, the relationship becomes a parent-child relationship. In this case, the Container which is housing the other Container is the parent. A Container might or might not have children.

A Container marked as a leaf Container will only contain items in it. Moreover, a Container can be automatically or manually disposed of if required.

Before diving into the types of Containers, let's understand what an item is.

What is an Item?

An item is an atomic (indivisible) physical object that does not contain any items or objects within. An item might or might not have a tracking ID.

An item can have the following properties:

  • Name: Name of the item (example: Microfibre Reversible Quilt Blanket).
  • Description: A short description of the item (example: Microfibre reversible quilt blanket for a single bed (120 GSM) in walnut brown color).
  • Cost: Total money that you have to pay for the item. Amount (float with 2 precision points) & Currency (string).
  • Quantity: The total number of items (default value: 1).
  • Measurement:
    • Value: A number quantifying measurement
    • Unit: A unit of measurement (cm/m/L/mL).

For a quick start guide on creating Containers, see Creating Containers.

Types of Container

Containers are the structures that store various items that need to be moved from point A to point B using. Some of the Container types are:

  • Bag
  • Package
  • Pallet
  • Trolley
  • Box

The Platform Tenant has the option to modify the custom Attributes of the default Container types and/or create additional Container types. In configurations, the Tenant will need to define the size(s) that each Container type can take and also if the particular Container is reusable.

Creating a Container Type

To create a Container Type, call the Create a new container type endpoint and pass the following parameters in the request body:

Member

Description

name

A unique name that represents a Container of this Container type

isLeaf

Defines whether this container-type will have actual physical items or not. Such types of Containers are termed leaf Containers.

allowedParent

Rules defining the allowed Container types as the parent of a Container type.

oneOf

List of Container types allowed as the parent of this Container type.

name

A unique name that represents a Container of this Container type.

ttl

Specifies the Time-to-live (TTL) for a Container of this Container type in the transaction database.

callback

Specifies a callback URL that is used to notify the calling of the result status of the call.

entityCode

Unique code of an entity.

🚧

NOTE

After a Container type is created it cannot be deleted and its name and isLeaf Attributes are immutable.

Request bodies are specified in JSON format. The following examples show a request body for creating a Container Type and a request body for updating a Container Type:

{
  "name": "bag",
  "isLeaf": false,
  "allowedParent": {
    "oneOf": [
      "trolley"
    ],
    "not": [
      "bag"
    ]
  },
  "ttl": "10d5h3m0s",
  "callback": "http://examplecallbackurl.com",
  "entityCode": "E-0001"
}
{
    "allowedParent": {
    "oneOf":[
        "Bag"
    ],
    "not":[
        "box"
    ]
  },
    "callback": "http://examplecallbackurl.com"

}

Attributes of a Container

Attributes of a Container can be divided into one of the following categories:

  • Base: These are the attributes mandated by the platform for the Container. Some of these attributes are mandatory.
  • Custom: These are the attributes that the Tenant defines for the Containers, to enhance their usability.

Tenants can define custom validations, and also specify for them to be indexed (if it is to be used in filtering APIs) or non-indexed.

In the case of a leaf Container, custom will have a mandatory attribute named items and non-leaf Containers will not be allowed to have this attribute.

Attribute Name

Category

Purpose

Data Type Expected

Tenant ID

Base

The ID of the tenant to whose data domain the Container belongs.

UUID

Container ID

Base

A system-generated unique ID for the Container.

VarChar

Scannable Tracking ID

Base

This is a physically affixed tracking ID (such as a Barcode) present on the Container for tracking it during a logistical process. This is to be used by the Tenant and Operators internally.

There can be multiple barcodes on a Container, generated by the Client, the Operator, and the Tenant, and hence it will be stored as a list. The Participant ID of the creator of the code also needs to be stored with the tracking ID. This Tracking ID needs to be reusable.

For Containers like Trolleys and Cold Storage Boxes, their tracking IDs will be reusable. Since multiple Containers may have sequentially used this tracking ID, a search on this tracking ID should return the Container that is in either of Created, Opened, or Closed states (unless the completed Containers are specifically asked). The completed state would imply that the Container is no longer in use.

List

Container Type
(Optional)

Base

This is a type of Container in use by the Tenant. For example, “Bag” packed at a PC, “Box” carrying a Book purchased from Amazon.

VarChar

Parent Container ID
(Optional)

Base

The ID of the parent Container inside which this Container is placed.

VarChar

Is Hazmat
(Optional)

Base

Specifies whether the Container can contain hazardous materials or not. Default value: False.

Boolean

isContainerizable
(Optional)

Base

Specifies whether the Container can be put into other Containers. Default value: False.

Boolean

Attributes 1 to n (Indexed)

Custom

Custom attributes for a Container with indexing. The tenant will be able to configure validations, if required, for these attributes.

Key-value

Attributes 1 to n (Non-indexed)

Custom

Custom attributes for a Container without indexing. The tenant will be able to configure validations, if required, for these attributes.

Key-value

📘

NOTE

Attributes such as the Capacity of a Container, or Is Container Temperature controlled, while essential to certain businesses, are not required to define a Container, and hence they have not been listed under Base attributes. The attributes can be defined in the Custom attributes section by the Tenant if needed.

Creating a Container

To create a Container of a particular Container Type, call the Create Container endpoint and pass the following parameters in the request body:

Member

Description

trackingDetails

A tracking ID (such as AWB) for a Container that is usually pasted on the Container and used for scanning it. There can be multiple tracking IDs for a Container, owned by different operators, and hence it will be stored as a list.

operator

Specifies the owner of the tracking ID.

trackingId

ID to track the Container.

isPrimary

Indicates whether it is a primary tracking ID or not. If not defined, the first tracking ID is used as the primary tracking ID.

items

The list of items that can be added to a Container only if the Container type is a leaf.

cost

The cost of the item.

unit

The unit price of the item.

amount

The value of the amount; accurate to three decimal places.

currency

Currency of the price of the item.

value

A number quantifying measurement.

unit

Unit for measurement.

attributes

A map to provide values for the attributes defined in Container-type configuration APIs.

isReusable

Indicates whether the Container is reusable.

isHazmat

Indicates whether this Container can contain hazardous materials.

callback

Specifies a callback URL that is used to notify the calling of the result status of the call.

Request bodies are specified in JSON format. The following examples show a request body for creating a Container and a request body for updating a Container:

{
   "trackingDetails":[
      {
         "operator":"WorldLogistics",
         "trackingId":"LM691328537CN",
         "isPrimary":false
      }
   ],
   "items":[
      {
         "name":"shirt",
         "cost":{
            "unit":{
               "amount":10,
               "currency":"USD"
            },
            "total":{
               "amount":100,
               "currency":"USD"
            },
            "quantity":{
               "value":10,
               "unit":"kg"
            }
         }
      }
   ],
   "attributes":{
      "color":"Black"
   },
   "isReusable":false,
   "isHazmat":false,
   "callback":"http://examplecallbackurl.com"
}
{
   "attributes":{
      "color":"red",
      "capacity.weight.max":77
   },
   "trackingDetails":[
      {
         "operator":"NationalLogistics",
         "trackingId":"PV691328537XD"
      }
   ],
   "isLeaf":false
}

Creating Custom Attributes

Custom attributes can be created by specifying the following parameters:
To create Custom Attributes for a Container, call the Update Container Type Attributes and pass the following parameters in the request body:

Member

Description

name

Name of the attribute to add.

dataType

Specifies the data type of the attribute. Valid values: string, number, boolean, object, array.

description

Description of the attribute.

tags

Tags for search.

indexed

Specifies whether the attribute is indexed. Filter or search operation on the basis of a custom attribute will be only allowed if this field is set as TRUE.

validation

Specifies the validations that are performed on the attribute when a Container of this type is created or updated.

range

Specifies the range that the attribute value must lie. In the case of the "string" data type, the range will be the length of the string value. [min: The min value, inclusive. max: The max value, inclusive.]

regex

Regex pattern that the string type data should match.

valueOneOf

Enum of accepted values.

required

Specifies whether the value is required or optional.

callback

Specifies a callback URL that is used to notify the calling of the result status of the call.

Request bodies are specified in JSON format. The following examples show a request body for creating a Container and a request body for updating a Container:

{
  "attributes": [
    {
      "name": "capacity",
      "dataType": "string",
      "description": "volume-attribute",
      "tags": [
        "volume", "quantity"
      ],
      "indexed": true,
      "defaultValue": "four",
      "validation": {
        "range": {
          "min": 3,
          "max": 100
        },
        "regex": "string",
        "valueOneOf": [
          "bag","box"
        ],
        "required": false
    }}
  ],
  "callback": "http://examplecallbackurl.com"
}

📘

Important Note regarding Custom Attribute creation

  • If the Attribute is already defined for the Container type, the validation rules are updated.
  • If the Attribute is not defined for the Container type, it is added as a new core attribute for the Container type.
  • On successful execution of the call, all updates including changes in data type take effect immediately for the Container type.

Lifecycle of a Container

The lifecycle depicts the current status of a Container. A Container typically can move between different states and substates, basis the workflows set in the application using it.

The platform will provide a default of four states for a Container:

  • Created: Specifies the creation of a Container. The system also generates a unique Container ID for the Container at this time.
  • Opened: Signifies readiness of Container to begin containerization operations (i.e. addition or removal of other Containers/packages/boxes/items). A Child Container cannot be “Opened” if the Parent Container is “Closed”.
  • Closed: Signifies termination of containerization process; at this point, no further containers/packages/boxes/items may be added to the Container. A Parent Container cannot be “Closed” if a Child container is “Opened”.
  • Completed: End of the lifecycle of a Container. When a Container is de-containerized, the status of the Container will automatically shift to this state.
13681368

👍

INFO

State Machine Service provides the Tenant an option to introduce sub-states under each of the States and the rules governing the corresponding state transitions.

Containerization

All physical items in a Container can be identified by their individual Tracking IDs but also share the Container’s Tracking ID. The process of grouping together boxes (or items or Containers) into a Container is called containerization; the opposite of this is de-containerization.

In the event that a Container is added to a Container, the relationship will be a parent-child relationship with the largest Container containing all other Containers (and their constituents) being the parent.

All operations performed on the parent Container are automatically inherited by the child Containers (e.g. all scan events on the parent Container are automatically propagated to the child Containers).

Conditions for Containerization

  • Parent Container state should be OPENED.
  • Child Container state should be CLOSED.
  • Parent Container should have isLeaf property as false.
  • Child Container should have isContainerizable as true.

Tenant Level Configurability and Extensibility

The Tenants have the following configurations available to them:

Attributes

  • Tenants have full control over defining Container types and the respective sizes for the Containers. For example, a bag can be 3x3 ft and 6x6 ft. They can also specify if a particular Container type is reusable.
  • Tenants can define a set of custom Indexed and Non-Indexed attributes for every Container type.
  • Tenants can define the duration after which they would like to move Inactive Containers to the data warehouse (default 72 hours).
  • The tenant can define whether the Container is a leaf Container (by using the isLeaf Base attribute). If the tenant defines a leaf Container, further, he has to define the “Items” attribute as a Custom Attribute.

Lifecycle

  • Tenants have the option to define a list of Event names for transition.
  • Tenants can define sub-states (i.e., custom lifecycle) for a particular container-type.
  • For each State, Tenants have the option to define a set of sub-states and the corresponding rules for State transition as defined in the State Machine documentation.

Did this page help you?