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.
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 device: 'Desktop',34 connection: 'cable',35 cookies: [36 {37 name: 'app.sid',38 value: 'sessionId',39 domain: 'calibreapp.com',40 path: '/',41 secure: true,42 httpOnly: true43 }44 ],45 headers: [46 {47 name: 'Authorization',48 value: 'Bearer 1234567890'49 }50 ]51 },52 {53 name: 'iPhone 8, 3G',54 device: 'iPhone8',55 connection: 'good3G'56 }57 ]58 try {59 const site = await Site.create({ name, agentSettings, pages, testProfiles })6061 console.log('Created', site)62 } catch (e) {63 console.error(e)64 }65}6667create()
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.
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()
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 |