Products

History

This section explains more about the snapshot management.

Documentation

Methods

The following methods are available to interact with the spreadsheet headers programmatically.
MethodDescription
getHistory Get the all the spreadsheet snapshots.
getHistory(): Promise<
{
versionId: string;
date: string;
size: number;
}[]
>


GET /api/:guid/history
setHistory Create a spreadsheet snapshot.
setHistory(): Promise<void>

POST /api/:guid/history
getVersion Get a specific spreadsheet snapshot.
getVersion(versionId: string): Promise<Spreadsheet>
@param versionId - searched version id

GET /api/:guid/history/:versionId
deleteVersion Delete a specific spreadsheet snapshot.
deleteVersion(versionId: string): Promise<void>
@param versionId - id of the version to be deleted

DELETE /api/:guid/history/:versionId
recoverVersion Recover the spreadsheet from a snapshot.
recoverVersion(versionId: string): Promise<void>
@param versionId - version id

POST /api/:guid/history/recover/:versionId


Examples

Manage the snapshots

Get a list of all spreadsheet snapshots.


NodeJS
PHP
import { Client } from '@jspreadsheet/client';

// Access token
const token = 'MSxlMjE2MWI5YWNjYTg2MzM4MThmN2Y4NjY0YmQzYzBlOGExMmVkZjVk';

// Spreadsheet Guid
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';

// Create a new client
const client = new Client(token);

// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);

// Request data
spreadsheet.getHistory().then((data) => {
    console.log(data);
});
// Not available in the PHP client library.


Create backups

How to create a new snapshot


NodeJS
PHP
import { Client } from '@jspreadsheet/client';

// Access token
const token = 'MSxlMjE2MWI5YWNjYTg2MzM4MThmN2Y4NjY0YmQzYzBlOGExMmVkZjVk';

// Spreadsheet Guid
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';

// Create a new client
const client = new Client(token);

// 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);
});
// Not available in the PHP client library.