Managing Sites


Create a Site

Required API Permission: Create Sites

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.

See the Calibre Agent page for a full list of Test Agent locations.
1calibre site create "<name>" --url="<url>" --location=<location>
1#!/usr/bin/env node
2
3const { Site } = require('calibre')
4
5const create = async () => {
6 const name = 'Calibre'
7
8 const agentSettings = {
9 location: 'Frankfurt',
10 scheduleAnchor: 6,
11 scheduleInterval: 'every_x_hours'
12 }
13
14 const pages = [
15 {
16 name: 'Home',
17 url: 'https://calibreapp.com/',
18 canonical: true
19 },
20 {
21 name: 'CLI Landing',
22 url: 'https://calibreapp.com/cli'
23 },
24 {
25 name: 'Insights',
26 url: 'https://calibreapp.com/insights'
27 }
28 ]
29
30 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: true
41 }
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 })
58
59 console.log('Created', site)
60 } catch (e) {
61 console.error(e)
62 }
63}
64
65create()
ParameterRequiredDescription
nameYesThe name of the site
locationYesThe Location tag for a test region; eg NorthVirgina
urlYesThe canonical URL to this site
scheduleNoSchedule for automated snapshots. One of: hourly, daily, every_x_hours
intervalNoAutomated snapshot interval. UTC hour of day for 'daily', hour interval for 'every_x_hours'

List all Sites

Required API Permission: Read Sites

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 node
2
3const { Site } = require('calibre')
4
5const main = async () => {
6 const sites = await Site.list()
7 console.log(sites)
8}
9
10main()

Delete a Site

Required API Permission: Delete Sites
1# Be careful! This is a dangerous and irreversible action.
2calibre site delete <slug> --confirm
1#!/usr/bin/env node
2
3const { Site } = require('calibre')
4
5// Be careful! This is a dangerous and irreversible action.
6const main = async () => {
7 await Site.destroy({ slug: 'my-site-slug' })
8}
9
10main()
ParameterRequiredDescription
slugYesSite slug, found in site settings