curl --request POST \
--url http://localhost:3000/api/v1/brands/{slug}/files/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"files": {},
"assets": {},
"commit": "<string>",
"message": "<string>",
"dryRun": true,
"merge": true,
"publish": true
}
'import requests
url = "http://localhost:3000/api/v1/brands/{slug}/files/import"
payload = {
"files": {},
"assets": {},
"commit": "<string>",
"message": "<string>",
"dryRun": True,
"merge": True,
"publish": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
files: {},
assets: {},
commit: '<string>',
message: '<string>',
dryRun: true,
merge: true,
publish: true
})
};
fetch('http://localhost:3000/api/v1/brands/{slug}/files/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/v1/brands/{slug}/files/import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'files' => [
],
'assets' => [
],
'commit' => '<string>',
'message' => '<string>',
'dryRun' => true,
'merge' => true,
'publish' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/v1/brands/{slug}/files/import"
payload := strings.NewReader("{\n \"files\": {},\n \"assets\": {},\n \"commit\": \"<string>\",\n \"message\": \"<string>\",\n \"dryRun\": true,\n \"merge\": true,\n \"publish\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/api/v1/brands/{slug}/files/import")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"files\": {},\n \"assets\": {},\n \"commit\": \"<string>\",\n \"message\": \"<string>\",\n \"dryRun\": true,\n \"merge\": true,\n \"publish\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/brands/{slug}/files/import")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"files\": {},\n \"assets\": {},\n \"commit\": \"<string>\",\n \"message\": \"<string>\",\n \"dryRun\": true,\n \"merge\": true,\n \"publish\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"brand": "<string>",
"applied": true,
"version": 0,
"published": 0,
"diff": {
"name": {
"before": "<string>",
"after": "<string>"
},
"rules": [
{
"change": "added",
"key": "<string>",
"context": "<string>",
"type": "color",
"before": "<unknown>",
"after": "<unknown>",
"fields": [
"<string>"
]
}
],
"pages": [
{
"change": "added",
"slug": "<string>",
"title": "<string>"
}
],
"theme": [
"<string>"
],
"reordered": true
},
"conflicts": [
{
"what": "<string>",
"ours": "<unknown>",
"theirs": "<unknown>"
}
],
"warnings": [
{
"file": "<string>",
"message": "<string>",
"line": 0
}
],
"pending": true
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"detail": {
"errors": [
{
"file": "<string>",
"message": "<string>",
"line": 0
}
],
"warnings": [
{
"file": "<string>",
"message": "<string>",
"line": 0
}
],
"missing": [
"<string>"
]
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"detail": "<unknown>"
}
}Take a brand from its files
The brand’s rules, pages, theme and name as the files say them, in one version of its history. With a source that remembers what both sides last agreed, what changed here since is kept: the files win only where both changed the same rule, page or setting, and conflicts names each. Files under assets/ are named in assets by id or by the SHA-256 of their bytes; a 422 lists every problem at its file and line (detail.errors) and the files to upload first (detail.missing). dryRun answers what would change. pending: the brand still holds changes the files lack, to export back. Takes setup on the workspace.
Scope: write.
curl --request POST \
--url http://localhost:3000/api/v1/brands/{slug}/files/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"files": {},
"assets": {},
"commit": "<string>",
"message": "<string>",
"dryRun": true,
"merge": true,
"publish": true
}
'import requests
url = "http://localhost:3000/api/v1/brands/{slug}/files/import"
payload = {
"files": {},
"assets": {},
"commit": "<string>",
"message": "<string>",
"dryRun": True,
"merge": True,
"publish": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
files: {},
assets: {},
commit: '<string>',
message: '<string>',
dryRun: true,
merge: true,
publish: true
})
};
fetch('http://localhost:3000/api/v1/brands/{slug}/files/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/v1/brands/{slug}/files/import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'files' => [
],
'assets' => [
],
'commit' => '<string>',
'message' => '<string>',
'dryRun' => true,
'merge' => true,
'publish' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/v1/brands/{slug}/files/import"
payload := strings.NewReader("{\n \"files\": {},\n \"assets\": {},\n \"commit\": \"<string>\",\n \"message\": \"<string>\",\n \"dryRun\": true,\n \"merge\": true,\n \"publish\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/api/v1/brands/{slug}/files/import")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"files\": {},\n \"assets\": {},\n \"commit\": \"<string>\",\n \"message\": \"<string>\",\n \"dryRun\": true,\n \"merge\": true,\n \"publish\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/brands/{slug}/files/import")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"files\": {},\n \"assets\": {},\n \"commit\": \"<string>\",\n \"message\": \"<string>\",\n \"dryRun\": true,\n \"merge\": true,\n \"publish\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"brand": "<string>",
"applied": true,
"version": 0,
"published": 0,
"diff": {
"name": {
"before": "<string>",
"after": "<string>"
},
"rules": [
{
"change": "added",
"key": "<string>",
"context": "<string>",
"type": "color",
"before": "<unknown>",
"after": "<unknown>",
"fields": [
"<string>"
]
}
],
"pages": [
{
"change": "added",
"slug": "<string>",
"title": "<string>"
}
],
"theme": [
"<string>"
],
"reordered": true
},
"conflicts": [
{
"what": "<string>",
"ours": "<unknown>",
"theirs": "<unknown>"
}
],
"warnings": [
{
"file": "<string>",
"message": "<string>",
"line": 0
}
],
"pending": true
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"detail": {
"errors": [
{
"file": "<string>",
"message": "<string>",
"line": 0
}
],
"warnings": [
{
"file": "<string>",
"message": "<string>",
"line": 0
}
],
"missing": [
"<string>"
]
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"detail": "<unknown>"
}
}Authorizations
An API key: ab_...
Path Parameters
Brand slug
Body
The brand's files by path in its folder: brand.yaml, rules/.yaml, pages/.yaml. Others are left alone
Show child attributes
Show child attributes
The files under assets/ the brand's files point at: path to asset id, or to the SHA-256 of its bytes (upload first)
Show child attributes
Show child attributes
The commit the files are at, when they are the repository's: recorded as agreed, when the brand has a source
1 - 100The commit's message: its first line names the version the import makes
2000Check and merge, answer what would change, write nothing
Keep what changed here since the source last agreed (default); false takes the files whole
Publish after, with this note (true: none). Takes share
Response
What changed
Show child attributes
Show child attributes