Update a brand
Replace an existing brand with the supplied values.
URL: https://api.courier.com/brands/:brand_id
Method: PUT
Path Parameters
brand_idstringrequired
A unique identifier associated with the brand you wish to update.
Body Parameters
namestringrequired
Brand name
settingsobjectrequired
+ Show Properties
snippetsobject
+ Show Properties
Responses
status: 200 Successfully replaced
creatednumber
The date/time of when the brand was created. Represented in milliseconds since Unix epoch.
idstring
Brand Identifier
namestring
Brand name
publishednumber
The date/time of when the brand was published. Represented in milliseconds since Unix epoch.
settingsobject
+ Show Properties
updatednumber
The date/time of when the brand was updated. Represented in milliseconds since Unix epoch.
snippetsobject
+ Show Properties
versionstring
The version identifier for the brand
status: 400 Bad Request
messagestring
A message describing the error that occurred.
typestring
[invalid_request_error] The type of error that occurred.
status: 404 Not Found
messagestring
A message describing the error that occurred.
typestring
[invalid_request_error] The type of error that occurred.
Request Example
- cURL
- Node.js
- Ruby
- Python
- Go
- PHP
curl --request PUT \
--url https://api.courier.com/brands/C8CPX6HQZ5M7Q5KAMW5CXC4N98DH \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Example Brand Name",
"settings": {
"colors": {
"primary": "#9D3789",
"secondary": "#9D3789",
"tertiary": "#9D3789"
},
"email": {
"footer": {
"markdown": "**Bold** and _italic_ with a [link](https://www.courier.com)",
"social": {
"facebook": {
"url": "https://www.facebook.com/example"
},
"instagram": {
"url": "https://www.instagram.com/example"
},
"linkedin": {
"url": "https://www.linkedin.com/example"
},
"medium": {
"url": "https://www.medium.com/example"
},
"twitter": {
"url": "https://www.twitter.com/example"
}
}
},
"header": {
"barColor": "#9D3789",
"logo": {
"href": "https://www.courier.com",
"image": "https://www.courier.com/logo.png"
}
}
}
}
}
'
// Dependencies to install:
// $ npm install node-fetch --save
const fetch = require('node-fetch');
const options = {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Example Brand Name",
"settings": {
"colors": {
"primary": "#9D3789",
"secondary": "#9D3789",
"tertiary": "#9D3789"
},
"email": {
"footer": {
"markdown": "**Bold** and _italic_ with a [link](https://www.courier.com)",
"social": {
"facebook": {
"url": "https://www.facebook.com/example"
},
"instagram": {
"url": "https://www.instagram.com/example"
},
"linkedin": {
"url": "https://www.linkedin.com/example"
},
"medium": {
"url": "https://www.medium.com/example"
},
"twitter": {
"url": "https://www.twitter.com/example"
}
}
},
"header": {
"barColor": "#9D3789",
"logo": {
"href": "https://www.courier.com",
"image": "https://www.courier.com/logo.png"
}
}
}
}
})
};
fetch('https://api.courier.com/brands/C8CPX6HQZ5M7Q5KAMW5CXC4N98DH', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.courier.com/brands/C8CPX6HQZ5M7Q5KAMW5CXC4N98DH")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request.body = "{\"name\":\"Example Brand Name\",\"settings\":{\"colors\":{\"primary\":\"#9D3789\",\"secondary\":\"#9D3789\",\"tertiary\":\"#9D3789\"},\"email\":{\"footer\":{\"markdown\":\"**Bold** and _italic_ with a [link](https://www.courier.com)\",\"social\":{\"facebook\":{\"url\":\"https://www.facebook.com/example\"},\"instagram\":{\"url\":\"https://www.instagram.com/example\"},\"linkedin\":{\"url\":\"https://www.linkedin.com/example\"},\"medium\":{\"url\":\"https://www.medium.com/example\"},\"twitter\":{\"url\":\"https://www.twitter.com/example\"}}},\"header\":{\"barColor\":\"#9D3789\",\"logo\":{\"href\":\"https://www.courier.com\",\"image\":\"https://www.courier.com/logo.png\"}}}}}"
response = http.request(request)
puts response.read_body
# Dependencies to install:
# $ python -m pip install requests
import requests
url = "https://api.courier.com/brands/C8CPX6HQZ5M7Q5KAMW5CXC4N98DH"
payload = {
"name": "Example Brand Name",
"settings": {
"colors": {
"primary": "#9D3789",
"secondary": "#9D3789",
"tertiary": "#9D3789"
},
"email": {
"footer": {
"markdown": "**Bold** and _italic_ with a [link](https://www.courier.com)",
"social": {
"facebook": {
"url": "https://www.facebook.com/example"
},
"instagram": {
"url": "https://www.instagram.com/example"
},
"linkedin": {
"url": "https://www.linkedin.com/example"
},
"medium": {
"url": "https://www.medium.com/example"
},
"twitter": {
"url": "https://www.twitter.com/example"
}
}
},
"header": {
"barColor": "#9D3789",
"logo": {
"href": "https://www.courier.com",
"image": "https://www.courier.com/logo.png"
}
}
}
}
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
response = requests.request("PUT", url, json=payload, headers=headers)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.courier.com/brands/C8CPX6HQZ5M7Q5KAMW5CXC4N98DH"
payload := strings.NewReader("{\"name\":\"Example Brand Name\",\"settings\":{\"colors\":{\"primary\":\"#9D3789\",\"secondary\":\"#9D3789\",\"tertiary\":\"#9D3789\"},\"email\":{\"footer\":{\"markdown\":\"**Bold** and _italic_ with a [link](https://www.courier.com)\",\"social\":{\"facebook\":{\"url\":\"https://www.facebook.com/example\"},\"instagram\":{\"url\":\"https://www.instagram.com/example\"},\"linkedin\":{\"url\":\"https://www.linkedin.com/example\"},\"medium\":{\"url\":\"https://www.medium.com/example\"},\"twitter\":{\"url\":\"https://www.twitter.com/example\"}}},\"header\":{\"barColor\":\"#9D3789\",\"logo\":{\"href\":\"https://www.courier.com\",\"image\":\"https://www.courier.com/logo.png\"}}}}}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
// Dependencies to install:
// $ composer require guzzlehttp/guzzle
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://api.courier.com/brands/C8CPX6HQZ5M7Q5KAMW5CXC4N98DH', [
'body' => '{"name":"Example Brand Name","settings":{"colors":{"primary":"#9D3789","secondary":"#9D3789","tertiary":"#9D3789"},"email":{"footer":{"markdown":"**Bold** and _italic_ with a [link](https://www.courier.com)","social":{"facebook":{"url":"https://www.facebook.com/example"},"instagram":{"url":"https://www.instagram.com/example"},"linkedin":{"url":"https://www.linkedin.com/example"},"medium":{"url":"https://www.medium.com/example"},"twitter":{"url":"https://www.twitter.com/example"}}},"header":{"barColor":"#9D3789","logo":{"href":"https://www.courier.com","image":"https://www.courier.com/logo.png"}}}}}',
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
]);
echo $response->getBody();
Responses Example
{
"created": 1591753605265,
"id": "C8CPX6HQZ5M7Q5KAMW5CXC4N98DH",
"name": "Example Brand Name",
"published": 1591753605265,
"settings": {
"colors": {
"primary": "#9D3789",
"secondary": "#9D3789",
"tertiary": "#9D3789"
},
"inapp": {
"preferences": {
"templateIds": [
null
]
}
},
"email": {
"footer": {
"markdown": "**Bold** and _italic_ with a [link](https://www.courier.com)",
"social": {
"facebook": {
"url": "https://www.facebook.com/example"
},
"instagram": {
"url": "https://www.instagram.com/example"
},
"linkedin": {
"url": "https://www.linkedin.com/example"
},
"medium": {
"url": "https://www.medium.com/example"
},
"twitter": {
"url": "https://www.twitter.com/example"
}
}
},
"header": {
"barColor": "#9D3789",
"logo": {
"href": "https://www.courier.com",
"image": "https://www.courier.com/logo.png"
}
}
}
},
"updated": 1591753605265,
"snippets": {
"items": [
{}
]
},
"version": "2020-06-19T18:51:36.083Z"
}
{
"message": "Error Message",
"type": "invalid_request_error"
}
{
"message": "Not Found",
"type": "invalid_request_error"
}
Example
Method: PUT
URL: https://api.courier.com/brands/C8CPX6HQZ5M7Q5KAMW5CXC4N98DH
Body:
{
"name": "Example Brand Name",
"settings": {
"colors": {
"primary": "#9D3789",
"secondary": "#9D3789",
"tertiary": "#9D3789"
},
"email": {
"footer": {
"markdown": "**Bold** and _italic_ with a [link](https://www.courier.com)",
"social": {
"facebook": {
"url": "https://www.facebook.com/example"
},
"instagram": {
"url": "https://www.instagram.com/example"
},
"linkedin": {
"url": "https://www.linkedin.com/example"
},
"medium": {
"url": "https://www.medium.com/example"
},
"twitter": {
"url": "https://www.twitter.com/example"
}
}
},
"header": {
"barColor": "#9D3789",
"logo": {
"href": "https://www.courier.com",
"image": "https://www.courier.com/logo.png"
}
}
}
}
}