To automate the creation of a site, you'll need a name, a url and a location. The Node.js API offers more extensive configuration options.
CLI
Node.js API
1calibre site create "<name>" --url="<url>" --location=<location>
1#!/usr/bin/env node23const { Site } = require('calibre')45const create = async () => {6 const name = 'Calibre'78 const agentSettings = {9 location: 'Frankfurt',10 scheduleAnchor: 6,11 scheduleInterval: 'every_x_hours'12 }1314 const pages = [15 {16 name: 'Home',17 url: 'https://calibreapp.com/',18 canonical: true19 },20 {21 name: 'CLI Landing',22 url: 'https://calibreapp.com/features/cli'23 },24 {25 name: 'Insights',26 url: 'https://calibreapp.com/features/insights'27 }28 ]2930 const testProfiles = [31 {32 name: 'Chrome Desktop',33 cookies: [34 {35 name: 'app.sid',36 value: 'sessionId',37 domain: 'calibreapp.com',38 path: '/',39 secure: true,40 httpOnly: true41 }42 ],43 headers: [44 {45 name: 'Authorization',46 value: 'Bearer 1234567890'47 }48 ]49 },50 {51 name: 'iPhone 8, 3G',52 device: 'iPhone8',53 connection: 'good3G'54 }55 ]56 try {57 const site = await Site.create({ name, agentSettings, pages, testProfiles })5859 console.log('Created', site)60 } catch (e) {61 console.error(e)62 }63}6465create()
Parameter | Required | Description |
---|---|---|
name | Yes | The name of the site |
location | Yes | The Location tag for a test region; eg NorthVirgina |
url | Yes | The canonical URL to this site |
schedule | No | Schedule for automated snapshots. One of: hourly, daily, every_x_hours |
interval | No | Automated snapshot interval. UTC hour of day for 'daily', hour interval for 'every_x_hours' |
team | No | Team slug, required when API Token is not scoped to a team. |
Use the CLI or Node.js API to generate a list of the sites in your account.
CLI
Node.js API
1calibre site list --json
1#!/usr/bin/env node23const { Site } = require('calibre')45const main = async () => {6 const sites = await Site.list()7 console.log(sites)8}910main()
CLI
Node.js API
1# Be careful! This is a dangerous and irreversible action.2calibre site delete <slug> --confirm
1#!/usr/bin/env node23const { Site } = require('calibre')45// Be careful! This is a dangerous and irreversible action.6const main = async () => {7 await Site.destroy({ slug: 'my-site-slug' })8}910main()
Parameter | Required | Description |
---|---|---|
slug | Yes | Site slug, found in site settings |