question

msm avatar image
msm asked David Marginian Deactivated edited

Is item's modifiedTime updated when stock is updated ?

I need to retrieve itemStock updates, but I also need the price.

I want to retrieve all updated items during a period of time, and filter by modifiedTime of itemStock, but in order to have that working, I need to know if item's modifiedTime updated when stock is updated ?

Inventory
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated edited

To accomplish what you are requesting I believe you would have to obtain all the item stocks (after or within a period of time):

/item_stocks?filter=modifiedTime>someTimeStamp

And then rip through the response, grab all the item ids and obtain the items:

/items?filter=id in ('itemId1','itemId2', etc.)


10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian Deactivated answered msm commented

I am not certain, that is something you can quickly verify through testing though.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

msm avatar image msm commented ·
Testing it with a set of items of 4-5k, gave 2 results where item update is 1 second before itemStock update.


It looks weird and thus I need a more certain answer

0 Likes 0 ·
David Marginian avatar image
David Marginian Deactivated answered

I ran a simple test where I updated the stock count of a single item and then checked the modifiedTime of the item, it was not updated. Only the modifiedTime of itemStock is updated. Here is the retrieval call of the item immediately following the stock update.

/items/redacted?expand=itemStock:

{
    "id": "redacted",
    "hidden": false,
    "available": true,
    "autoManage": false,
    "name": "T-bone",
    "price": 0,
    "priceType": "FIXED",
    "defaultTaxRates": true,
    "cost": 0,
    "isRevenue": true,
    "stockCount": 0,
    "itemStock": {
        "item": {
            "id": "redacted"
        },
        "stockCount": 50,
        "quantity": 50.0,
        "modifiedTime": 1636035184000
    },
    "modifiedTime": 1625230938000
}
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community