Creating snapshots

You can create snapshots with the CLI, Node.JS API or by using the HTTP Site API.

Creating snapshots using the CLI

Create a snapshot using the following command:

$ calibre site create-snapshot --site=my-site
✔ Snapshot created: 1588

To create snapshots as part of your continuous integration or deployment system, run the snapshot command with the addition of the --json flag.

$ calibre site create-snapshot --site=my-site --json
{
  "iid": 1588,
  "ref": null,
  "htmlUrl": "https://calibreapp.com/my-org/my-site/snapshots/1589",
  "createdAt": "2018-01-01T16:20:00Z"
}

Deployment snapshots

Snapshots can be created with a reference to help you pinpoint when certain changes were made (think git-sha, or release number).

To add a ref to snapshots, use the --ref flag.

$ calibre site snapshot my-site --json --ref=confetti-time!
{
  "iid": 1588,
  "ref": "confetti-time!",
  "htmlUrl": "https://calibreapp.com/my-org/my-site/snapshots/1589",
  "createdAt": "2018-01-01T16:20:00Z"
}

If ref is longer than 40 characters, your snapshot will be rejected.

Creating snapshots using the Node.JS API

The open source repository for CLI also contains working code examples of the Node.js API.

Creating snapshots using the HTTP Site API

The snapshot endpoint is https://calibreapp.com/api/sites/site-slug/snapshots. You can find your site-slug on the Site Settings page.

To create a snapshot, make a POST request to https://calibreapp.com/api/sites/site-slug/snapshots with the following URL parameters:

  • secret: Your site's secret key (found on the site settings page)
  • ref: A reference for the snapshot (e.g. git hash or tag name)