How to: Change the Container state

For information about prerequisites, see Creating Containers.

Before you can containerize a child Container, must set the parent and child containers to the appropriate lifecycle state. For more information about Lifecycle States, see the 'Lifecycle of a Container' in Container .

The parent Container must be in the opened state, and the child container must be in the closed state.

By default, the state of a new Container is created. To set a Container to opened, you must specify an event code of E-025 and a reason code of R-0001 in the request body.

To set the parent container to opened, call the Apply Event on Container endpoint and pass a request body similar to the following:

{
  "eventCode": "E-025",
  "timestamp": 1661375504,
  "reasonCode":"R-0001",
  "data": {
  },
  "source": {
    "appId": "sid3",
    "userId": "sid2",
    "locId":"sid2"
  }
}

The response body will look similar to the following:

{
    "data": {
        "id": "pallettwo:0e0aa8d6-b5ae-4ed4-99f8-deff50fef3b2",
        "state": "opened:opened",
        "event": {
            "eventCode": "E-025",
            "reasonCode": "R-0001",
            "timestamp": 1661474301,
            "propagate": false,
            "data": {},
            "source": {
                "appId": "sid3",
                "userId": "sid2",
                "locId": "sid2"
            }
        },
        "stateChange": true
    },
    "request": {
        "uri": "/core/api/v1/containers/pallettwo:0e0aa8d6-b5ae-4ed4-99f8-deff50fef3b2/state/event",
        "method": "PUT",
        "body": {
            "eventCode": "E-025",
            "timestamp": 1661375504,
            "reasonCode": "R-0001",
            "data": {},
            "source": {
                "appId": "sid3",
                "userId": "sid2",
                "locId": "sid2"
            }
        }
    }
}

App ID is required and should be set to the Client ID of your App. For information about registering an App and retrieving the Client ID, see the "Register an App" section of Getting started with building Apps.

A leaf container must be in the closed state to be containerized. States are sequential. A new Container is in the created state, you must set the Container to opened and then to closed.

To set the child box Container to opened, call the Apply Event on Container endpoint and pass a request body similar to the following:

{
    "data": {
        "id": "boxtwo:1a3057a3-fc75-40ed-ac28-989c9d3d1551",
        "state": "opened:opened",
        "event": {
            "eventCode": "E-026",
            "reasonCode": "R-0001",
            "timestamp": 1661375504,
            "propagate": false,
            "data": {},
            "source": {
                "appId": "sid3",
                "userId": "sid2",
                "locId": "sid2"
            }
        },
        "stateChange": true
    }
}

To set the child box Container to closed, call the Apply Event on Container endpoint and pass a request body that specifies an event code of E-026:

{
  "eventCode": "E-026",
  "timestamp": 1661375504,
  "reasonCode":"R-0001",
  "data": {
  },
  "source": {
    "appId": "sid3",
    "userId": "sid2",
    "locId":"sid2"
  }
}