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:

MemberDescriptionValidationData type
nameA unique name that represents a Container of this Container typepattern: ^[a-zA-Z]{3,16}$
minLength: 3
maxLength: 64
example: bag
string
isLeafDefines whether this container-type will have actual physical items or not. Such types of Containers are termed leaf Containers.default: falseboolean
allowedParentRules defining the allowed Container types as the parent of a Container type.minProperties: 1
oneOfList of Container types allowed as the parent of this Container type.minItems: 1
maxItems: 16
pattern: ^[a-z]{1,16}$
minLength: 3
maxLength: 64
string
callbackSpecifies a callback URL that is used to notify the calling of the result status of the call.pattern: https?:\/\/(www\.)?[[email protected]:%._\+~#=]{2,256}\.[a-z]{2,4}\b([[email protected]:%_\+.~#?&//=]*)string
entityCodeUnique code of an entity.pattern: ^(?!0000|^$)([0-9][0-9][0-9][0-9])$string

🚧

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": "99d",
    "callback": {
        "url": "https://examplecallbackurl.com",
        "meta": {
            "key1": "Post ptp type"// Optional. Meta object can not exceed 256 Bytes.
        }
    }
}
  "entityCode": "E-0001"
}
{
    "allowedParent": {
    "oneOf":[
        "Bag"
    ],
    "not":[
        "box"
    ]
  },
   {
    "callback": {
        "url": "https://examplecallbackurl.com",
        "meta": {
            "key1": "Post ptp type"// Optional. Meta object can not exceed 256 Bytes.
        }
    }
}

}

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 NameCategoryPurposeData Type Expected
Tenant IDBaseThe ID of the tenant to whose data domain the Container belongs.UUID
Container IDBaseA system-generated unique ID for the Container.VarChar
Scannable Tracking IDBaseThis 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)
BaseThis 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)
BaseThe ID of the parent Container inside which this Container is placed.VarChar
Is Hazmat
(Optional)
BaseSpecifies whether the Container can contain hazardous materials or not. Default value: False.Boolean
isContainerizable
(Optional)
BaseSpecifies whether the Container can be put into other Containers. Default value: False.Boolean
Attributes 1 to n (Indexed)CustomCustom 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)CustomCustom 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:

MemberDescriptionValidationData type
trackingDetailsA 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.
operatorSpecifies the owner of the tracking ID.minLength: 3
maxLength: 64
example: Delhivery
string
trackingIdID to track the Container.minLength: 1
maxLength: 128
example: 13212123
string
isPrimaryIndicates whether it is a primary tracking ID or not. If not defined, the first tracking ID is used as the primary tracking ID.default: falseboolean
itemsThe list of items that can be added to a Container only if the Container type is a leaf.
costThe cost of the item.
unitThe unit price of the item.number
amountThe value of the amount; accurate to three decimal places.number
currencyCurrency of the price of the item.number
valueA number quantifying measurement.integer
unitUnit for measurement.Valid values: cm, m, l, ml, nos, g, kg, mm.string
attributesA map to provide values for the attributes defined in Container-type configuration APIs.
isReusableIndicates whether the Container is reusable.default: falseboolean
isHazmatIndicates whether this Container can contain hazardous materials.default: falseboolean
callbackSpecifies a callback URL that is used to notify the calling of the result status of the call.pattern: https?:\/\/(www\.)?[[email protected]:%._\+~#=]{2,256}\.[a-z]{2,4}\b([[email protected]:%_\+.~#?&//=]*)string

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": {
        "url": "https://examplecallbackurl.com",
        "meta": {
            "key1": "Post ptp type"// Optional. Meta object can not exceed 256 Bytes.
        }
    }
}
}
{
   "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:

📘

Custom Attributes

Learn about Custom Attribute Entitlement Framework.

MemberDescriptionValidationData type
nameName of the attribute to add.pattern: ^[a-zA-Z_]{1,32}$
example: capacity
minLength: 3
maxLength: 64
string
dataTypeSpecifies the data type of the attribute. Valid values: string, number, boolean, object, array.Valid values: string, number, boolean, object, arraystring
descriptionDescription of the attribute.minLength: 1
maxLength: 256
string
indexedSpecifies 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.boolean
isReadPublicTrue: All apps can read the Custom Attributes.
False (default): Only CAO and OTO will be able to read the Custom Attributes. To learn more, see Custom Attribute Doc.
default: falseboolean
validationSpecifies the validations that are performed on the attribute when a Container of this type is created or updated.
rangeSpecifies 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.]number
regexRegex pattern that the string type data should match.minLength: 1
maxLength: 512
string
valueOneOfEnum of accepted values.minItems: 1
requiredSpecifies whether the value is required or optional.default: falseboolean
callbackSpecifies a callback URL that is used to notify the calling of the result status of the call.pattern: https?:\/\/(www\.)?[[email protected]:%._\+~#=]{2,256}\.[a-z]{2,4}\b([[email protected]:%_\+.~#?&//=]*)string

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,
      "isReadPublic": false,
      "defaultValue": "four",
      "validation": {
        "range": {
          "min": 3,
          "max": 100
        },
        "regex": "string",
        "valueOneOf": [
          "bag","box"
        ],
        "required": false
    }}
  ],
  {
    "callback": {
        "url": "https://examplecallbackurl.com",
        "meta": {
            "key1": "Post ptp type"// Optional. Meta object can not exceed 256 Bytes.
        }
    }
}
}

📘

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.
1368

👍

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.