Is there a way to update stock of item by ean/sku - retail?

JarekJarek Member Posts: 8
edited September 21 in Development

Hi,

I want to update stock of item


<Item>

  <itemID>3</itemID>

  <systemSku readonly="true">210000000003</systemSku>

  <defaultCost currency="EUR">0</defaultCost>

  <avgCost currency="EUR">0</avgCost>

  <discountable>true</discountable>

  <tax>true</tax>

  <archived>false</archived>

  <itemType>default</itemType>

  <serialized>false</serialized>

  <description>Test Style</description>

  <modelYear>0</modelYear>

  <upc />

  <ean>601382303003</ean>

  <customSku>601382303003</customSku>

  <manufacturerSku />

  <createTime>2020-09-10T11:25:30+00:00</createTime>

  <timeStamp>2020-09-15T11:14:18+00:00</timeStamp>

  <publishToEcom>true</publishToEcom>

  <categoryID>0</categoryID>

  <taxClassID>1</taxClassID>

  <departmentID>0</departmentID>

  <itemMatrixID>0</itemMatrixID>

  <manufacturerID>0</manufacturerID>

  <seasonID>0</seasonID>

  <defaultVendorID>0</defaultVendorID>

  <ItemShops>

   <ItemShop>

     <itemShopID>8</itemShopID>

     <qoh>-3</qoh>

     <sellable readonly="true">0</sellable>

     <backorder>0</backorder>

     <componentQoh>0</componentQoh>

     <componentBackorder>0</componentBackorder>

     <reorderPoint>0</reorderPoint>

     <reorderLevel>0</reorderLevel>

     <timeStamp>2020-09-16T12:49:03+00:00</timeStamp>

     <itemID>3</itemID>

     <shopID>1</shopID>

     <MetaData>

      <layaways>0</layaways>

      <specialorders>0</specialorders>

      <workorders>0</workorders>

     </MetaData>

   </ItemShop>

   <ItemShop>

     <itemShopID>7</itemShopID>

     <qoh>-3</qoh>

     <sellable readonly="true">0</sellable>

     <backorder>0</backorder>

     <componentQoh>0</componentQoh>

     <componentBackorder>0</componentBackorder>

     <reorderPoint>0</reorderPoint>

     <reorderLevel>0</reorderLevel>

     <timeStamp>2020-09-16T12:49:03+00:00</timeStamp>

     <itemID>3</itemID>

     <shopID>0</shopID>

     <MetaData>

      <layaways>0</layaways>

      <specialorders>0</specialorders>

      <workorders>0</workorders>

     </MetaData>

   </ItemShop>

  </ItemShops>

  <Prices>

   <ItemPrice>

     <amount currency="EUR">5</amount>

     <useTypeID>1</useTypeID>

     <useType readonly="true">Default</useType>

   </ItemPrice>

   <ItemPrice>

     <amount currency="EUR">5</amount>

     <useTypeID>2</useTypeID>

     <useType readonly="true">MSRP</useType>

   </ItemPrice>

   <ItemPrice>

     <amount currency="EUR">5</amount>

     <useTypeID>3</useTypeID>

     <useType readonly="true">Online</useType>

   </ItemPrice>

  </Prices>

</Item>


To do that now I need

account id - no problem

shop id - no problem

I've ean 601382303003

but I cannot use it so I've to get somehow itemID but that's enough since I've on item shopID 0,1

and cannot skip on update shopID it fail on update of shop 0 since active shop is 1

so to update qoh I need to execute something like that:


curl -X PUT -H "Authorization: Bearer xxx" \

-d '{ 

   "ItemShops": { "ItemShop": [{ "itemShopID": 8, "qoh": 13 }]}

  }' "https://api.lightspeedapp.com/API/Account/yyy/Item/3.json"

   

Is there any simple way to do that just having ean and shop id?


P.S.

to create new discussion for retail API is madness

Post edited by LucienVersendaal on

5 comments

  • gregaricangregarican Member Posts: 522 

    ShopID 0 is a read-only node, which represents the sum on-hand total for all "real" shops.

  • JarekJarek Member Posts: 8

    :)

    My base question was if there is a way to update stock using ean/sku not

    to get first item to check what it has itemID and after also check for

    itemShopID. Just simple way update by ean/sku with ignoring shopID=0.


    P.S. for eCom Api there is a clear category but not for retail


  • gregaricangregarican Member Posts: 522 

    In order to update a stock item in Retail, you need to specify its ItemID. As for documentation, the Retail API documentation is located here --> https://developers.lightspeedhq.com/retail/introduction/introduction/. And if you have multiple shops then you would presumably need to specify which shops have which on-hand counts. Using the respective ShopID's and ItemShopID's that pertain.

  • JarekJarek Member Posts: 8

    What is the best way to get the ItemID and ShopID based on the ean? The problem is that a third party is creating the items in Lightspeed and we only have the ean barcode available when we need to update the stock.

  • gregaricangregarican Member Posts: 522 
    edited September 24

    If the third party is creating the items in Lightspeed via the API then they should be getting back the ItemID's in the API responses being sent back to them. I'd recommend pressing them to read what they are getting back in response. Since I don't believe you can issue a PUT API request based on just an EAN or UPC.

    Although you can query for item based on an EAN or UPC. Like this:

    "https://api.merchantos.com/API/Account/{AccountID}/Item.json?ean=1234567890123"

    Once you get back your ItemID's in the response then you can issue a second API request as a PUT to modify what you need to. I realize it's two API requests per item, but still a workaround.

Sign In or Register to comment.