Create a Site#
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
Check the Calibre Agent page for a full list of Test Agent locations.
calibre site create "<name>" --url="<url>" --location=<location>#!/usr/bin/env node
import { Site } from 'calibre'
const create = async () => {
const name = 'Calibre'
const agentSettings = {
location: 'Frankfurt',
scheduleAnchor: 6,
scheduleInterval: 'every_x_hours'
}
const pages = [
{
name: 'Home',
url: 'https://calibreapp.com/',
canonical: true
},
{
name: 'Pricing',
url: 'https://calibreapp.com/pricing'
},
{
name: 'Product',
url: 'https://calibreapp.com/product/rum'
}
]
const testProfiles = [
{
name: 'Chrome Desktop',
device: 'Desktop',
connection: 'cable',
cookies: [
{
name: 'app.sid',
value: 'sessionId',
domain: 'calibreapp.com',
path: '/',
secure: true,
httpOnly: true
}
],
headers: [
{
name: 'Authorization',
value: 'Bearer 1234567890'
}
]
},
{
name: 'iPhone 8, 3G',
device: 'iPhone8',
connection: 'good3G'
}
]
try {
const site = await Site.create({ name, agentSettings, pages, testProfiles })
console.log('Created', site)
} catch (e) {
console.error(e)
}
}
create()List all Sites#
Read Sites
Use the CLI or Node.js API to generate a list of the sites in your account.
calibre site list --json#!/usr/bin/env node
import { Site } from 'calibre'
const main = async () => {
const sites = await Site.list()
console.log(sites)
}
main()Delete a Site#
Delete Sites
# Be careful! This is a dangerous and irreversible action.
calibre site delete <slug> --confirm#!/usr/bin/env node
import { Site } from 'calibre'
// Be careful! This is a dangerous and irreversible action.
const main = async () => {
await Site.destroy({ slug: 'my-site-slug' })
}
main()