Offline sync
Reps often work in stores with no signal, so the field app treats offline as normal. It keeps a local copy of everything it needs and sends store checks when it can.
The offline package
Section titled “The offline package”GET /v1/{team}/syncThe response has five parts:
| Key | What’s in it |
|---|---|
assignments |
The rep’s pending and in_progress visits, outside closed campaigns, each with its checklist and customer. |
audit_types |
Active checklists the rep can submit, with their fields. |
customers |
Active customers. |
campaigns |
Open campaigns behind the rep’s visits, with their items and detail fields. |
last_synced_at |
The server time of this sync. |
Records here use numeric ids, which is what customer_id expects when you submit a store check.
JSON columns such as settings, options and validation are always objects, never [], so typed clients can model them as maps.
Keeping it fresh
Section titled “Keeping it fresh”- On first sign-in, call
syncwithout parameters and store everything. - Next time, send
sinceset to the previouslast_synced_at. You get only visits, checklists and customers that changed since then. Campaigns are always sent in full. - Merge the changes into the local copy by
id, then save the newlast_synced_at.
Sync when the app opens, when it comes back online and when the rep pulls to refresh. Show the time of the last sync in the app, as the styleguide’s offline rules ask.