Skip to content

Preview a proposed change

POST
/api/v1/brands/{slug}/previews
curl --request POST \
--url http://localhost:3000/api/v1/brands/example/previews \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "ref": "example", "title": "example", "commit": "example", "files": { "additionalProperty": "example" }, "assets": { "additionalProperty": "example" } }'

A pull request’s files as the brand’s site, at a link that needs no account, and what they would change of the brand as it stands. Checked as an import is. One preview per ref: saving again keeps its link. It opens for 30 days after its last save.

Scope: write.

slug
required
string

Brand slug

Media typeapplication/json
object
ref
required

What proposes it, as its host names it: pull/12. One preview each; saving again updates it

string
>= 1 characters <= 200 characters
title
string
<= 300 characters
commit
string
>= 1 characters <= 100 characters
files
required

The brand’s files by path in its folder: brand.yaml, rules/.yaml, pages/.yaml. Others are left alone

object
key
additional properties
string
<= 2000000 characters
assets

The files under assets/ the brand’s files point at: path to asset id, or to the SHA-256 of its bytes (upload first)

object
key
additional properties
string
<= 64 characters
Examplegenerated
{
"ref": "example",
"title": "example",
"commit": "example",
"files": {
"additionalProperty": "example"
},
"assets": {
"additionalProperty": "example"
}
}

The preview

Media typeapplication/json
object
data
required
object
brand
required
string
ref
required
string
url
required

The site as the files say it; no account needed

string format: uri
pages
required
Array<object>
object
slug
required
string
title
required
string
url
required
string format: uri
expiresAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/
diff
required

What it would change of the brand as it stands

object
name
required
Any of:
object
before
required
string
after
required
string
rules
required
Array<object>
object
change
required
string
Allowed values: added removed changed
key
required
string
context
required
string | null
type
required
string
Allowed values: color text number list font
before
after
fields

What changed: value, usage, label, spec, assets, type

Array<string>
pages
required
Array<object>
object
change
required
string
Allowed values: added removed changed moved
slug
required
string
title
required
string
fields

Changed: the page’s own fields that changed (title, lede…)

Array<string>
sections

Changed: its sections that changed, by id

Array<object>
object
change
required
string
Allowed values: added removed changed moved
id
required
string
template
required
string
title
required
string
fields

Changed: which of its fields

Array<string>
theme
required

Theme settings changed

Array<string>
reordered
required

The rules’ order changed

boolean
warnings
required
Array<object>
object
file
required
string
line
integer
>= -9007199254740991 <= 9007199254740991
message
required
string
Example
{
"data": {
"diff": {
"rules": [
{
"change": "added",
"type": "color"
}
],
"pages": [
{
"change": "added",
"sections": [
{
"change": "added"
}
]
}
]
}
}
}

An error

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
detail
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"detail": "example"
}
}