How we detect if some Images are deleted from Item Matrix or Item?

tin_litin_li Member Posts: 6
edited December 2020 in Development

Hello there,

I am integrating to check push images from Lightspeed to another system.

It is going good with add new images, but when I delete images, there is no way to detect it.

Because we have >20k items, >10k images. We need to order by timeStamp to check if there is images have been deleted to integrated with another System.

Thanks for reading.

Tin

10 comments

  • tin_litin_li Member Posts: 6

    Same thing for inventories in Item. When we delete inventories, the Item is not update timeStamp.

    The timeStamp only update when add new inventories into Item.

    Tin

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 585 moderator

    Hi @tin_li,

    Thank you for contacting us.

    What you can do is check if there is an Image object related to that Item.

    /Item?load_relations=["Images"]
    

    If there is no image object, there's no image.

  • tin_litin_li Member Posts: 6
    edited December 2020

    Hi @LucienVersendaal

    Thank you for your reply,

    How about if I have 3 images, then I delete 1 images.

    So I have remaining 2 images. Do we have way to check I have just delete 1 image from that Item or that ItemMatrix?

    Thank you!

    Tin

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 585 moderator

    Hi @tin_li,

    Good question!

    The best way to do that is to build a log yourself for every call you're making with the API, so you can track your changes. As extra check you can do a call to that endpoint above to check how many images you have in comparison with your logs.

  • tin_litin_li Member Posts: 6

    Hi @LucienVersendaal

    Yes, I am doing that way,

    But we have around >20k products, it takes a lot of time to check.

    Can we have another field like timeStamp should be update when I delete Images or Inventories from Item?

    Thank you in advance.

    Tin

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 585 moderator

    Hi @tin_li,

    I've tested this but when you delete the image the timestamp of the item is changed, but this also happens when you change the title for example. So this isn't very secure.

  • tin_litin_li Member Posts: 6

    Hi @LucienVersendaal

    The timeStamp of the item isn't changed, if you don't press the Save Changes button.

    But the images can be deleted without pressing Save Changes button.

    Tin

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 585 moderator

    Hi @tin_li,

    Sorry I was testing to delete the image through the UI and check in the API if the timestamp was updated, and that worked. This has to do with clicking the save button.

    Just what I was mentioning earlier this isn't a secure way to check.

  • tin_litin_li Member Posts: 6

    Hi @LucienVersendaal

    You can delete the image without clicking the save button, the image will still be deleted.

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 585 moderator

    @tin_li

    Correct. When deleting the image you get a warning as well.


Sign In or Register to comment.