Skip to main content
Version: V2 (Ignition 8.1)

Inventory Script API

Welcome to the Inventory Script API documentation. This API provides a comprehensive set of functions for managing and interacting with inventory within the system. Below is a list of available functions, each with a brief description and a link to its detailed documentation.

Function List​

checkLocationHasCapacity​

Checks if the Locations record can store the given quantity of material. Returns a boolean indicating whether the location can accommodate the given quantity of inventory. Returns a boolean indicating whether the location can accommodate the given quantity of inventory.

NOTE: If the inventory lot ID is provided, the material ID parameter becomes optional but must not be None; instead, use an empty string. If the inventory lot name is provided instead of its ID, the material ID is required to locate the lot in the database, as two lots with the same name may belong to different materials.

newConsumeRequest​

Generates an empty non-persisted Consume Request to provide the structure required by the API to save a new record into the database. This method must be combined with the consume method in order to persist the record. Returns a JSON representation of the newly created Consume Request object.

consume​

Consumes inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Consume Request.

validateConsumeRequest​

Validates a consume request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newUnconsumeRequest​

Generates an empty non-persisted Unconsume Request to provide the structure required by the API to save a new record into the database. This method must be combined with the unconsume method in order to persist the record. Returns a JSON representation of the newly created Unconsume Request object.

unconsume​

Unconsumes inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for an Unconsume Request.

validateUnconsumeRequest​

Validates an unconsume request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newProduceRequest​

Generates an empty non-persisted Produce Request to provide the structure required by the API to save a new record into the database. This method must be combined with the produce method in order to persist the record. Returns a JSON representation of the newly created Produce Request object.

produce​

Produces inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Produce Request.

validateProduceRequest​

Validates a produce request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newMoveRequest​

Generates an empty non-persisted Move Request to provide the structure required by the API to save a new record into the database. This method must be combined with the move method in order to persist the record. Returns a JSON representation of the newly created Move Request object.

move​

Moves inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Move Request.

validateMoveRequest​

Validates a move request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newSplitRequest​

Generates an empty non-persisted Split Request to provide the structure required by the API to save a new record into the database. This method must be combined with the split method in order to persist the record. Returns a JSON representation of the newly created Split Request object.

split​

Splits inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Split Request.

validateSplitRequest​

Validates a split request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newMergeRequest​

Generates an empty non-persisted Merge Request to provide the structure required by the API to save a new record into the database. This method must be combined with the merge method in order to persist the record. Returns a JSON representation of the newly created Merge Request object.

merge​

Merges inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Merge Request.

validateMergeRequest​

Validates a merge request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newScrapRequest​

Generates an empty non-persisted Scrap Request to provide the structure required by the API to save a new record into the database. This method must be combined with the scrap method in order to persist the record. Returns a JSON representation of the newly created Scrap Request object.

scrap​

Scraps inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Scrap Request.

validateScrapRequest​

Validates a scrap request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newReturnRequest​

Generates an empty non-persisted Return Request to provide the structure required by the API to save a new record into the database. This method must be combined with the returnInventory method in order to persist the record. Returns a JSON representation of the newly created Return Request object.

returnInventory​

Returns inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Return Request.

validateReturnRequest​

Validates a return request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newChangeStatusRequest​

Generates an empty non-persisted Change Status Request to provide the structure required by the API to save a new record into the database. This method must be combined with the changeStatus method in order to persist the record. Returns a JSON representation of the newly created Change Status Request object.

changeStatus​

Changes the status of the inventory lot from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Change Status Request.

validateChangeStatusRequest​

Validates a change status request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newEditInventoryQuantityRequest​

Generates an empty non-persisted Edit Inventory Quantity Request to provide the structure required by the API to save a new record into the database. This method must be combined with the editInventoryQuantity method in order to persist the record. Returns a JSON representation of the newly created Edit Inventory Quantity Request object.

editInventoryQuantity​

Edit inventory quantity from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for an Edit Inventory Quantity Request.

validateEditInventoryQuantityRequest​

Validates an edit inventory quantity request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newReceiveRequest​

Generates an empty non-persisted Receive Request to provide the structure required by the API to save a new record into the database. This method must be combined with the receive method in order to persist the record. Returns a JSON representation of the newly created Receive Request object.

receive​

Receives inventory into the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Receive Request.

validateReceiveRequest​

Validates a receive request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

newShipRequest​

Generates an empty non-persisted Ship Request to provide the structure required by the API to save a new record into the database. This method must be combined with the ship method in order to persist the record. Returns a JSON representation of the newly created Ship Request object.

ship​

Ships inventory from the MES based on the provided parameters. Returns a JSON representation of an inventory lot record for a Ship Request.

validateShipRequest​

Validates a ship request based on the provided parameters. Returns a JSON object where keys are field names and values are lists of validation violation messages.

executeInventoryActions​

Executes a list of inventory actions in a single transaction. That means that if any of the actions fail, none of them will be executed, and any changes made to the database will be rolled back. Returns a list of JSON representation of inventory lot records for the inventory actions executed.

setInventoryMetadata​

Updates the metadata for a given Inventories record by its ID. This includes the notes and spare fields. Returns a JSON representation of an inventory.

publishInventoryState() and (List<String>)​

No Parameter: Publishes all of the Inventories to the tag system.

With a Parameter: Publishes only the specified Inventories to the tag system given the ID or path of the location associated with the inventory.

If successful, no response is returned.

getInventoryForMaterial​

Retrieves the Inventories records for a specific material. Returns a list of JSON objects representing all inventories for a specific material.

getInventoryByLotAndLocation​

Retrieves the Inventories record based on the inventory lot and location. Returns a JSON representation of an inventory.

getAllInventory​

Retrieves all the Inventories records. Returns a list of JSON objects representing all inventories.

getAllInventoryAtLocation​

Retrieves all the Inventories records at a given location. Returns a list of JSON objects representing all inventories at the given location.

getAllInventoryForLocationAndChildren​

Retrieves all the Inventories records at a given location and its children. Returns a list of JSON objects representing all inventories at the given location and its children.

getAllInventoryFor​

Retrieves all Inventories for a location, material, lot, and/or statuses. Any of the parameters can be left blank to not filter by that parameter. If location is provided it will search for inventory at that location and all child locations.

newLot​

Generates an empty non-persisted Inventory Lots object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveLot method in order to persist the record. Returns a JSON representation of the newly created Inventory Lot object.

saveLot​

Creates or updates an Inventory Lots record in the system based on the provided parameters. Returns a JSON representation of the saved inventory lot.

findLots​

Retrieves Inventory Lots records based on the specified pagination, sort, and column constraint parameters. Returns a Query Result object.

getLot​

Retrieves an Inventory Lots record by its ID. Returns a JSON representation of the inventory lot.

getLotByIdOrNameAndMaterial​

Retrieves an Inventory Lots record by its ID or name and by the material ID or path. If no material ID or path is provided, retrieves an Inventory Lots record by its ID or name. Returns a JSON representation of an inventory lot.

getAllLots​

Retrieves a list of all Inventory Lots records in the system. Returns a list of JSON objects representing all inventory lots.

getLotsForMaterial​

Retrieves a list of all Inventory Lots records in the system for a specified material using its ID or path. Returns a list of JSON objects representing all inventory lots for a specified material.

doesLotExist​

Checks if an Inventory Lots record with the given material and lot name exists in the system. Returns a boolean.

findLotIdsByLocationDateRangeAndMaterial​

Finds Inventory Lots IDs matching the specified location, material, and date range criteria. Returns an array of lot ID strings.

getInventoryLotReferences​

Retrieves a list of references to a Inventory Lots record by its ID. Returns a list of JSON objects.

validateLot​

Validates the specified parameters for an Inventory Lots record and returns any validation errors. This only checks if the inventory lot object can be saved based on the attributes given. Returns a JSON object where keys are field names and values are lists of validation violation messages.

deleteLot​

Deletes an Inventory Lots record by its ID. This cannot delete a inventory lot with references to it. If successful, an ApiResponse Object is returned with the success bool set True. If the inventory lot that's being deleted has a reference, a JSON object is returned with details about the encountered error.

newInventoryLotRecord​

Generates an empty non-persisted Inventory Lot Records object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveInventoryLotRecord method in order to persist the record. Returns a JSON representation of the newly created Inventory Lot Record object.

saveInventoryLotRecord​

Creates or updates an Inventory Lot Records object in the system based on the provided parameters. Returns a JSON representation of the saved inventory lot record.

getInventoryLotRecordReferences​

Retrieves a list of references to an Inventory Lot Records object by its ID. Returns a list of JSON objects.

validateInventoryLotRecord​

Validates the specified parameters for an Inventory Lot Records object and returns any validation errors. This only checks if the inventory lot object can be saved based on the attributes given. Returns a JSON object where keys are field names and values are lists of validation violation messages.

getInventoryLotRecordsByLocationPathPrefixAndDateRange​

Retrieves all Inventory Lot Records for the specified location path prefix and date range.

newLotHistoryRequest​

Generates an empty non-persisted Lot History Request to provide the structure required by the API to retrieve records from the database. This method must be combined with the getLotHistory method to retrieve the records. Returns a JSON representation of the newly created Lot History Request object.

getLotHistory​

Retrieves all Inventory Lot Records given the inventory lot and other parameters. Returns a list of JSON objects representing all inventory lot records for an inventory lot and other parameters.


Explore each function’s documentation for detailed usage examples and additional information.