Skip to content

History

This section explains more about the snapshot backup management.

The following methods are available to interact with the spreadsheet headers programmatically.

MethodDescription
getHistoryRetrieves all snapshots of the spreadsheet.

GET /api/:guid/history
Returns: A promise resolving to a list of snapshot metadata (versionId, date, size).
setHistoryCreates a new snapshot of the spreadsheet.

POST /api/:guid/history
Returns: A promise resolving when the snapshot is created.
getVersionRetrieves a specific snapshot by its version ID.

GET /api/:guid/history/:versionId
Returns: A promise resolving to the snapshot data.
deleteVersionDeletes a specific snapshot by its version ID.

DELETE /api/:guid/history/:versionId
Returns: A promise resolving when the snapshot is deleted.
recoverVersionRecovers the spreadsheet from a specific snapshot version.

POST /api/:guid/history/recover/:versionId
Returns: A promise resolving when the spreadsheet is recovered.

Get a list of all spreadsheet snapshots.

import { Client } from "@intrasheets/client";
// Create a new client
const client = new Client({
// API Server
baseUrl: "http://localhost:8009/api",
// Your authentication token
token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",
});
// Spreadsheet Guid
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
// Request data
spreadsheet.getHistory().then((data) => {
console.log(data);
});

How to create a new snapshot

import { Client } from "@intrasheets/client";
// Create a new client
const client = new Client({
// API Server
baseUrl: "http://localhost:8009/api",
// Your authentication token
token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",
});
// Spreadsheet Guid
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
// Set Data
spreadsheet.setHistory().then(() => {
// It worked correctly
}).catch((err) => {
// Something went wrong
console.log(err);
});