Products

History

This section explains more about the snapshot backup management.

Documentation

Methods

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

Method Description
getHistory Retrieves all snapshots of the spreadsheet.

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

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

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

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

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

Examples

Manage the snapshots

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);
});

Create backups

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);
});