404 when converting lite server id

in Development
I'm getting a 404 from the /PosServer/rest/liteserverConversion/receipt/{receiptId} API call. If I try the same call again a bit later it works.
I understand from the docs that it "periodically syncs to the cloud", can you explain how that works, exactly what "periodically" means, and what I need to do to reliably convert the liteserver receipt ID?
Thanks.
4 comments
Hi, can someone explain more precisely what "periodically" means? I need to know how soon I can attempt to convert the liteserver receipt ID, or what steps I need to take to do it reliably.
Thanks.
Hey @pauld,
The liteserver's purpose is to enable you to have a local network of devices that can still function in operation (i.e. take sales and payments) even when your internet is down. It does this by first sending the data to the Liteserver, and then it will sync in real time to the cloud.
In the event that internet goes down, the liteserver will enable the network to be sustained and will batch the data to be synced.
The period in between the loss of internet will be the time-frame in which you won't be able to get a cloud receiptId because the data hasn't been synced yet, that's why you're getting a 404, as the data hasn't reached the cloud servers yet.
To get around this, you might want to either simply batch those liteserver receiptID conversions to a slower schedule, do periodic retries for failures and or have some kind of internet network analyser that will tell you the health of the internet and have the conversions be done only when the internet is connected.
I hope this helps!
Adrian Samuel
Software Developer
Lightspeed HQ
Thanks @Adrian Samuel. And can you confirm that a 404 from the /PosServer/rest/liteserverConversion/receipt/{receiptId} API call means that it just hasn't been forwarded yet?
So it attempts to sync "in real time" to the cloud, but I'm managing to hit the liteserverConversion API before it's ready so guess I need to wait to account for a small delay then.
Hey @pauld I can confirm that this is the case :)
Adrian Samuel
Software Developer
Lightspeed HQ