Update and restore a document

This procedure is for the ordinary stored notes.html in Build a shared note, using its trusted authoring connection. It is not a platform-wide backup or disaster-recovery procedure.

Separate a release from a content reset

The editor and the live note are different files. Before publishing an editor change, read the current note through WebDAV and keep that returned body and its ETag together. Upload only the editor file. Read the note again and compare it with the saved copy. The checked example preserved the stored note exactly while the editor changed.

Preserve the stored representation returned by WebDAV, not an old local starter file or a composed public view. See WebDAV representations. Keep each file's own validator with its body; do not substitute the selector GET's tag for a whole-document restore.

Restore conditionally

Use a WebDAV client that can send an explicit If-Match header and show the response. Through that authoring connection:

  1. GET the whole current document. Save its response body and ETag before changing it.
  2. To restore a previously saved body, PUT that body to the same document with If-Match set to the whole-document tag on which your decision was based.
  3. If another writer changed the document since that read, stop on 412 Precondition Failed. The test preserved the newer content. Do not remove the condition or silently fetch a new tag and repeat the old body.
  4. GET the current source, compare it with the proposed restored copy, and explicitly decide which content to retain. Preserve both copies outside the site while deciding.
  5. Only after that review, submit your chosen body with the freshly read whole-document tag. Another intervening edit can require another review.
  6. Read the stored source again and compare it with the chosen body. Also read the paragraph through the public application endpoint to check the visitor-facing result.

In the isolated test, a stale restore returned 412; the reviewed restore was accepted and the subsequent stored body matched the saved copy exactly. This establishes that sequence for the tested ordinary document, not byte preservation for every uploaded format or a multi-document transaction.

Know the authoring boundary

An accepted WebDAV restore intentionally bypasses application validation and application handlers. It does not mean that schema, relationship, shape, or transition rules accepted the restored content. Validate the content against your intended application policy before restoring it, then run appropriate application reads and acceptance/refusal probes.

Authoring still needs its authentication, storage, routing, and runtime dependencies. Unreadable metadata can prevent a repair before persistence; see validation and runtime availability. Preserve the failed response and seek platform-operator help when authoring itself cannot read or save the resource.

For a test exercise, remove only your disposable directory and verify its absence. For a real release, record which files changed, the saved copies, observed results, and the explicit restore decision. Troubleshooting covers uncertain write outcomes; do not interpret a lost response as proof that no write occurred.