{{{ #!html

Sync Process

  1. Zotero client sends a /login request to the server with a username and password and, upon successful authentication, gets back a session key. Z client uses this session key in all subsequent requests until a) Firefox is restarted, b) the key expires due to inactivity, or c) the client logs out with a /logout request.
  2. Zotero sends a /lock request to the server to get an exclusive session lock, which prevents other clients from syncing at the same time. This may be adjusted in the future to allow other clients that haven't made local changes to pull updated data, but for now they'll just get an error.
  3. Zotero finds all objects (items, creators, collections, etc.) that have been added, changed, or deleted since the last time it synced. (The ids of deleted objects are saved by a Zotero.Notifier observer at delete time.)
  4. Zotero sends an /updated request with the server timestamp of the last successful sync. Z server sends back XML of all data updated on the server since that timestamp. The XML is validated on the server using RELAX-NG before it's sent to the client.
  5. Zotero processes the updated object data from the server and compares it to local data:

    1. If an object has changed only remotely, it is saved/updated/deleted locally.
    2. If an object has the same primary id (a small integer) as a local object but a different secondary key (a unique string generated at object creation time), it is a different object, so the primary id of the local version is changed to an available id.
    3. If an object has been modified both locally and remotely, Zotero displays a conflict resolution window allowing you to choose between either version and make manual edits to the merged version.
  6. Zotero converts updated objects into XML and POSTs to /upload. The uploaded XML is validated on the server using RELAX-NG, and the server saves the new data, overwriting existing data.
  7. Zotero sends an /unlock request to the server, freeing other clients to sync.

Additional Details

}}}