Composite Create
POST …/wms/lgfapi/v10/entity/iblpn/composite_create/
This operation allows for the creation of a Received or Located IBLPN along with one or more inventory records in a single request. Furthermore, it allows for the creating and/or association of the inventory’s corresponding batch and inventory attribute, where applicable. This API follows all of the same validations and extended actions, such as writing inventory history, as the standalone create (POST) APIs for each entity, but brings them together in a single API.
Furthermore, this API takes advantage of allowing for the input of nested data, such as batch and inventory attribute, which will allow for those objects to be created or retrieved if they already exist. The use of the related objects “id” value is still permitted as well. All objects must have the same facility and company context as the IBLPN being created, and must still pass all standard user eligibility validations.
When the Composite Create API is called, an error will be returned if the appropriate serial number information is not provided for any serial number tracked items:
This change avoids the requirement of making multiple API calls to complete the linking.
The following is an example body for composite create:
{
"fields": {
"facility_id": 269, <== Will be inherited by objects
"company_id": 48, <== Will be inherited by objects
"iblpn": {
"container_nbr": "IBLPN000001",
"status_id": 30,
"curr_location_id": 28536,
"putawaytype_id":1020,
"length": 1.1234567,
"width": 2.34567890,
"height": 3.123
},
"inventory": [ <== List of dictionaries, one per inventory record.
{
"item_id": 1,
"expiry_date": "2019-01-01",
"curr_qty": 1.2345,
"batch_number_id": 1,
"invn_attr_id": 2,
"serial_nbr_list": [ <== Single Inventory can have multiple serial numbers.
"SN1",
"SN2",
"SN3"
]
}
]
},
"options": {
"reason_code": "IT",
"validate_serial_nbrs_flg": false
}
}
This API also has unique data structure requirements that mimic those of the individual entity’s create (POST) field inputs. It also allows for the definition of a global context where “facility_id” and “company_id” may be defined at the top level of the data and inherited by each object, if not defined on the object.
Category | Parameter | Type | Required | Default | Description |
fields | facility_id | Integer | C | “id” value of Facility. Not required if defined on the IBLPN or per object. | |
fields | company_id | Integer | C | “id” value of Company. Not required if defined on the IBLPN or per object. | |
fields | iblpn | Dictionary | X | Field value definitions for the IBLPN being created. These are the same as if using a standalone POST request for creating an IBLPN. | |
fields | inventory | Array | X | A list of one or more inventory objects to be created and associated with the given IBLPN. | |
options | reason_code | String | X | Used for inventory history tracking. |
The following is an example of JSON request data where the facility/company context is defined at the top level and using the “id” values of “batch_number_id” and “invn_attr_id” to associate those objects that already exist. The defined top-level facility and company will be applied to the iblpn and inventory objects being created. The existing batch and inventory attribute objects being associated to the inventory must be of the same context.
{
"fields": {
"facility_id": 1,
"company_id": 1,
"iblpn": {
"container_nbr": "IBLPN000001",
"status_id": 30,
"curr_location_id": 28536
},
"inventory": [
{
"item_id": 1,
"curr_qty": 1.2345,
"batch_number_id": 1,
"invn_attr_id": 1
}
]
},
"options": {
"reason_code": "IT"
}
}
The following is an example of JSON request data where the facility/company context is defined per object and using the “id” values of “batch_number_id” and “invn_attr_id” to associate those objects that already exist. Also demonstrates creating multiple inventory records for different item/batch/attribute combinations in a single IBLPN:
{
"fields": {
"iblpn": {
"facility_id": 1,
"company_id": 1,
"container_nbr": "IBLPN000002",
"status_id": 10
},
"inventory": [
{
"facility_id": 1,
"item_id": 1,
"curr_qty": 1.2345,
"batch_number_id": 1,
"invn_attr_id": 1
},
{
"facility_id": 1,
"item_id": 2,
"curr_qty": 10,
"batch_number_id": 2,
"invn_attr_id": 2
}
]
},
"options": {
"reason_code": "IT"
}
}
{
"fields": {
"facility_id": 1,
"company_id": 1,
"iblpn": {
"container_nbr": "IBLPN000003",
"status_id": 10
},
"inventory": [
{
"item_id": 3,
"curr_qty": 1,
"batch_number_id": {
“batch_nbr”: “BATCH001”,
“item_id”: 3,
“expiry_data”: “2019-01-01”
},
"invn_attr_id": {
“invn_attr_a”: “A”,
“invn_attr_b”: “B”,
“invn_attr_c”: “C”
}
}
]
},
"options": {
"reason_code": "IT"
}
}