Keeping your catalog fresh
Last updated ยท Page 4 of 5
| Run | When | What it reads |
|---|---|---|
| Full sync | First, once | Every product in your scope |
| Full resync | Every 8 hours: the minimum | Every product again, then stop listing what the walk did not return |
| Delta refresh | Every hour: optional | Only what changed since your last refresh (updatedSince) |
A delta returns every product whose price, content or status changed since updatedSince,
expired products included: stop listing those. A delta alone is not enough: it cannot show you an
offer that left your scope or stopped being sellable for another reason, which only the full
resync removes. The catalog you walk is LivingSocial for Agents' copy of Groupon's,
refreshed every hour, so a delta more often than that finds nothing new. A change of only
merchantRating, merchantWebsite, rating, bought, a location's hours or its phone does not bring a product into a delta:
the full resync refreshes them.
One walk serves all three runs:
text
seen = empty set # resync only
params = { country: "US", limit: 100 } # delta: add updatedSince: lastRefreshAt
cursor = none
repeat:
page = GET https://api-core.livingsocial.com/partner_storefront/products?params (+ cursor if set)
upsert every product in page.data by its id # replace options, prices, status
add every id in page.data to seen # resync only
cursor = page.nextCursor
until page.hasMore == false
stop listing every product whose id is not in seen # resync only; keep the row
lastRefreshAt = page.timestamp # the final page's timestamp