Skip to main content

How-to: Add and Remove Container Items with ESP Client

Issue:

Is it possible to add and remove items from a container via the ESP Client?

Solution:

Yes this is possible within ESP to add items, and there is a workaround in place to remove. Please see descriptions below:

Add Items to Container

  • Items can be added to a container via api - put_items_in_slots()

  • E.g.: con.put_items_in_slots(items=items, slots=slots)

  • The items can be samples, containers etc depending upon the container type configurations

Remove Items from Container

  • Unfortunately, there is no remove_items_in_slots() api in client; however, there are workarounds to follow in case an item is to be removed via ESP Client

  • If the container type accepts only One ‘Elements per location’ then try:

con.items[0]['item_uuid'] = []
con.push()

2. If the container type accepts Unlimited ‘Elements per location’ then try:

response = esp.base.SESSION.put('/api/containers/cfa50f78-1563-48ec-bf87-a100c52b4d47/remove_item',
    ...:     json = {
    ...:         "loc": "SHELF-01-01"
    ...:     }
    ...: )
con.refresh()
  • Alternatively, "loc": "<label>" can also be used within the json block, the label here refers to the slots/location label (Eg: 'SHELF-01-01', A01, etc)

NOTE: The container must be refreshed/reloaded after running the above code for the changes to reflect on the GUI, hence ensure to run a <container>.refresh() every time