Add a brand rule
curl --request POST \
--url http://localhost:3000/api/v1/brand/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key": "<string>",
"type": "color",
"value": "<string>",
"context": "<string>",
"usage": "<string>",
"assets": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'import requests
url = "http://localhost:3000/api/v1/brand/rules"
payload = {
"key": "<string>",
"type": "color",
"value": "<string>",
"context": "<string>",
"usage": "<string>",
"assets": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
}
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({
key: '<string>',
type: 'color',
value: '<string>',
context: '<string>',
usage: '<string>',
assets: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
})
};
fetch('http://localhost:3000/api/v1/brand/rules', 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/brand/rules",
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([
'key' => '<string>',
'type' => 'color',
'value' => '<string>',
'context' => '<string>',
'usage' => '<string>',
'assets' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
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/brand/rules"
payload := strings.NewReader("{\n \"key\": \"<string>\",\n \"type\": \"color\",\n \"value\": \"<string>\",\n \"context\": \"<string>\",\n \"usage\": \"<string>\",\n \"assets\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\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/brand/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"<string>\",\n \"type\": \"color\",\n \"value\": \"<string>\",\n \"context\": \"<string>\",\n \"usage\": \"<string>\",\n \"assets\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/brand/rules")
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 \"key\": \"<string>\",\n \"type\": \"color\",\n \"value\": \"<string>\",\n \"context\": \"<string>\",\n \"usage\": \"<string>\",\n \"assets\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brand": "<string>",
"key": "<string>",
"context": "<string>",
"type": "color",
"value": "<string>",
"usage": "<string>",
"assets": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rendition": "<string>",
"title": "<string>",
"filename": "<string>",
"mime": "<string>",
"width": 0,
"height": 0
}
],
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"detail": "<unknown>"
}
}API Reference
Add a brand rule
One per key and context; 409 when it exists. value must match type. ?brand= picks the brand; the default otherwise. Every change to rules lands in the brand’s history.
Scope: write.
POST
/
api
/
v1
/
brand
/
rules
Add a brand rule
curl --request POST \
--url http://localhost:3000/api/v1/brand/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key": "<string>",
"type": "color",
"value": "<string>",
"context": "<string>",
"usage": "<string>",
"assets": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'import requests
url = "http://localhost:3000/api/v1/brand/rules"
payload = {
"key": "<string>",
"type": "color",
"value": "<string>",
"context": "<string>",
"usage": "<string>",
"assets": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
}
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({
key: '<string>',
type: 'color',
value: '<string>',
context: '<string>',
usage: '<string>',
assets: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
})
};
fetch('http://localhost:3000/api/v1/brand/rules', 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/brand/rules",
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([
'key' => '<string>',
'type' => 'color',
'value' => '<string>',
'context' => '<string>',
'usage' => '<string>',
'assets' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
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/brand/rules"
payload := strings.NewReader("{\n \"key\": \"<string>\",\n \"type\": \"color\",\n \"value\": \"<string>\",\n \"context\": \"<string>\",\n \"usage\": \"<string>\",\n \"assets\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\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/brand/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key\": \"<string>\",\n \"type\": \"color\",\n \"value\": \"<string>\",\n \"context\": \"<string>\",\n \"usage\": \"<string>\",\n \"assets\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/brand/rules")
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 \"key\": \"<string>\",\n \"type\": \"color\",\n \"value\": \"<string>\",\n \"context\": \"<string>\",\n \"usage\": \"<string>\",\n \"assets\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brand": "<string>",
"key": "<string>",
"context": "<string>",
"type": "color",
"value": "<string>",
"usage": "<string>",
"assets": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rendition": "<string>",
"title": "<string>",
"filename": "<string>",
"mime": "<string>",
"width": 0,
"height": 0
}
],
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"detail": "<unknown>"
}
}Authorizations
bearersession
An API key: ab_...
Query Parameters
A brand's slug
Body
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
Maximum string length:
120Pattern:
^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$Allowed value:
"color"Pattern:
^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$Only in this context; omit for the default
Maximum string length:
64Pattern:
^[a-z0-9]+(-[a-z0-9]+)*$How and when to use it, in Markdown (GFM)
Maximum string length:
10000Assets it points at, in order: an id, or { id, rendition }. Replaces the list
Maximum array length:
24Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Response
Created
Show child attributes
Show child attributes