Get stock searching by timestamp

fanaticfanatic Member Posts: 5

I have a cron to read product changes in LS DB and sync with my website and other platform. I use this cron only with modificated products in last 30 minutes, using timestamp query parameter. This works fine when someone modify a product in LS, but when LS sales something and change product stock (inside ItemShop) it doesn't refresh product timestamp and I don't get this important modification in my cron request.

How can I get the item stock (qoh) after LS sale, without asking for all products, using something like timestamp.

Thanks,

Fidel Vázquez

4 comments

  • sam123456sam123456 Member Posts: 51
    edited June 2020

    I'm also interested in this if it's possible. Maybe query for products sold in the last 30 minutes and then also check those skus for changes?

    .. though I fear the answer might be to query all products every 30 minutes. If all of us do it, maybe they'll make this information easier to access ;)

  • tiegostiegos Member Posts: 12

    also interested, posted this question 2 times

    the solution would be for now, is catch all productId's and do a seperate request to each product sold.. i think

  • gregaricangregarican Member Posts: 594 

    Too bad Retail doesn't have webhooks to automatically trigger sending off the transactional-based data. Most cloud-based solutions possess this mechanism...sigh...

  • lancemuzlancemuz Member Posts: 14

    Although the time stamp for the item does not get updated, the time stamp inside the ItemShop relation does get updated. Here is an example using https://api.lightspeedapp.com/API/Account/[account #]/Item.json?load_relations=["ItemShops"]&ItemShops.timeStamp=>,2021-01-17T18:00:00 after a sale at shopID 1. Notice that the timeStamp inside ItemShops is updated for shopID 1 and 0 and that I used "ItemShops.timeStamp" as a query paramter.

    {

      "@attributes": {

        "count": "1"

      },

      "Item": {

        "itemID": "35476",

        "systemSku": "210000035506",

        "defaultCost": "71.5",

        "avgCost": "65.07",

        "discountable": "true",

        "tax": "true",

        "archived": "false",

        "itemType": "default",

        "serialized": "false",

        "description": "NB W880v10-W- G LightSlate/BaliBlue 7.5 B",

        "modelYear": "0",

        "upc": "194182000580",

        "ean": "",

        "customSku": "",

        "manufacturerSku": "W880G10",

        "createTime": "2020-01-29T23:53:22+00:00",

        "timeStamp": "2020-10-22T02:54:12+00:00",

        "publishToEcom": "false",

        "categoryID": "8",

        "taxClassID": "1",

        "departmentID": "0",

        "itemMatrixID": "1063",

        "manufacturerID": "60",

        "seasonID": "0",

        "defaultVendorID": "60",

        "ItemShops": {

          "ItemShop": [

            {

              "itemShopID": "351266",

              "qoh": "0",

              "sellable": "0",

              "backorder": "0",

              "componentQoh": "0",

              "componentBackorder": "0",

              "reorderPoint": "0",

              "reorderLevel": "0",

              "timeStamp": "2021-01-17T18:24:31+00:00",

              "itemID": "35476",

              "shopID": "1",

              "m": {

                "layaways": "0",

                "specialorders": "0",

                "workorders": "0"

              }

            },

            {

              "itemShopID": "351267",

              "qoh": "0",

              "sellable": "0",

              "backorder": "0",

              "componentQoh": "0",

              "componentBackorder": "0",

              "reorderPoint": "0",

              "reorderLevel": "0",

              "timeStamp": "2020-12-19T21:44:24+00:00",

              "itemID": "35476",

              "shopID": "2",

              "m": {

                "layaways": "0",

                "specialorders": "0",

                "workorders": "0"

              }

            },

            {

              "itemShopID": "351268",

              "qoh": "1",

              "sellable": "1",

              "backorder": "0",

              "componentQoh": "0",

              "componentBackorder": "0",

              "reorderPoint": "0",

              "reorderLevel": "0",

              "timeStamp": "2021-01-15T20:02:18+00:00",

              "itemID": "35476",

              "shopID": "3",

              "m": {

                "layaways": "0",

                "specialorders": "0",

                "workorders": "0"

              }

            },

            {

              "itemShopID": "351265",

              "qoh": "1",

              "sellable": "1",

              "backorder": "0",

              "componentQoh": "0",

              "componentBackorder": "0",

              "reorderPoint": "0",

              "reorderLevel": "0",

              "timeStamp": "2021-01-17T18:24:31+00:00",

              "itemID": "35476",

              "shopID": "0",

              "m": {

                "layaways": "0",

                "specialorders": "0",

                "workorders": "0"

              }

            }

          ]

        },

        "Prices": {

          "ItemPrice": [

            {

              "amount": "129.99",

              "useTypeID": "1",

              "useType": "Default"

            },

            {

              "amount": "129.99",

              "useTypeID": "2",

              "useType": "MSRP"

            }

          ]

        }

      }

    }

Sign In or Register to comment.