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.

Tip
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/features/cli'
23 },
24 {
25 name: 'Insights',
26 url: 'https://calibreapp.com/features/insights'
27 }
28 ]
29
30 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: true
43 }
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 })
60
61 console.log('Created', site)
62 } catch (e) {
63 console.error(e)
64 }
65}
66
67create()
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'
teamNoTeam slug, required when API Token is not scoped to a team.

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