Execute a PCD point-in-time restore
const url = 'https://example.com/api/v1/pcd/1/snapshots/1/rollback';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"expectedCurrentStateHash":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/pcd/1/snapshots/1/rollback \ --header 'Content-Type: application/json' \ --data '{ "expectedCurrentStateHash": "example" }'Restores PCD state to this snapshot by rewinding the append-only op log (issue #16). No op rows are deleted; a durable pre-rollback snapshot is captured first. The body’s expectedCurrentStateHash (from the preview) guards against an apply-after-change race — a mismatch returns 422 and the caller must regenerate the preview.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”PCD database ID
PCD snapshot ID
Request Bodyrequired
Section titled “Request Bodyrequired”Request body to execute a rollback. expectedCurrentStateHash is a from-state value-guard echoed from the preview’s currentStateHash; if the live state changed since the preview the request is rejected with 422.
object
The preview’s currentStateHash (may be empty string when no published ops exist)
Examplegenerated
{ "expectedCurrentStateHash": "example"}Responses
Section titled “Responses”Rollback executed
object
Ops written after the snapshot that were superseded
Pre-snapshot ops deactivated since that were re-published
The durable pre-rollback capture that makes this rollback reversible
Example
{ "status": "success"}Invalid parameters or missing expectedCurrentStateHash
object
Examplegenerated
{ "error": "example"}Snapshot not found or doesn’t belong to database
object
Examplegenerated
{ "error": "example"}Snapshot cannot be reconstructed/verified (unrestorable)
object
Examplegenerated
{ "error": "example"}Database state changed since preview; regenerate the preview and retry
object
Examplegenerated
{ "error": "example"}Rollback execution failed
object
Examplegenerated
{ "error": "example"}