curl --request GET \
--url https://{host}/v1/brands \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v1/brands', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/v1/brands",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://{host}/v1/brands"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"data": [
{
"type": "brands",
"id": "19",
"attributes": {
"name": "Rolex",
"logo": "https://cdn.wristler.eu/square-medium/rolex-logo.png",
"watches": 6276,
"filterPageSlug": "rolex"
}
},
{
"type": "brands",
"id": "12",
"attributes": {
"name": "Omega",
"logo": "https://cdn.wristler.eu/square-medium/omega-logo.png",
"watches": 4215,
"filterPageSlug": "omega"
}
},
{
"type": "brands",
"id": "204",
"attributes": {
"name": "Nivrel",
"logo": null,
"watches": 3,
"filterPageSlug": null
}
}
],
"meta": {
"total": 191
}
}{
"errors": [
{
"status": "404",
"code": "watch_reserved",
"title": "Not Found",
"detail": "<string>",
"meta": {},
"source": {
"pointer": "/data/attributes/reference",
"parameter": "<string>"
}
}
],
"jsonapi": {
"version": "1.0"
}
}List brands
Scope: catalogue:read
Every brand there is something to buy of, with its logo and how many listings the
catalogue has of it. What a “Brands” screen is made of, in one answer: the tiles at
the top are the rows that have a logo, the list underneath is all of them
re-sorted by name.
Ordered by watches, largest first — which is the order the tiles want, and
why there is no sort. Take the first however-many with logo !== null for those.
Not paged, deliberately: the screen is an A–Z index with a search field over
it, and an index you have to page through is not an index. It is around 190 rows of
four fields, and meta.total says how many, so a client can check it got
everything.
logo is null for most brands. A logo is editorial — 18 of the 503 brands have
one, and they are the ones the website puts in its own brand grid. Draw the name as
the label and the logo as decoration you may not get.
watches is the catalogue’s own count, not the database’s: a listing that is
for sale from a shop that can take payment, which is the same rule that puts it in
the index. So the number on a tile is the number of results
filter[brand][]=<name> on /v1/watches comes back with. Brands with nothing for
sale are left out rather than answered as 0.
This is not the brand facet. The facet says what the search you just ran has
in it (every brand in it, uncapped); this says what the catalogue has at all. A
screen that lists every brand wants this one.
filterPageSlug is the brand’s own page on the website, in the language of
Accept-Language: the page the website’s brand links open, at /{watches}/{slug}
(/horloges/rolex in Dutch). Null when the brand has no page in that language; the
website then links to the catalogue filtered by the brand, and so should a universal link
or a share.
Cached for four hours, the same window the website’s brand overview uses: what is
for sale changes all day, which brands exist does not. An ETag comes with it, so
opening the screen again is a 304.
curl --request GET \
--url https://{host}/v1/brands \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v1/brands', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/v1/brands",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://{host}/v1/brands"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"data": [
{
"type": "brands",
"id": "19",
"attributes": {
"name": "Rolex",
"logo": "https://cdn.wristler.eu/square-medium/rolex-logo.png",
"watches": 6276,
"filterPageSlug": "rolex"
}
},
{
"type": "brands",
"id": "12",
"attributes": {
"name": "Omega",
"logo": "https://cdn.wristler.eu/square-medium/omega-logo.png",
"watches": 4215,
"filterPageSlug": "omega"
}
},
{
"type": "brands",
"id": "204",
"attributes": {
"name": "Nivrel",
"logo": null,
"watches": 3,
"filterPageSlug": null
}
}
],
"meta": {
"total": 191
}
}{
"errors": [
{
"status": "404",
"code": "watch_reserved",
"title": "Not Found",
"detail": "<string>",
"meta": {},
"source": {
"pointer": "/data/attributes/reference",
"parameter": "<string>"
}
}
],
"jsonapi": {
"version": "1.0"
}
}Authorizations
Response
Every brand with something for sale, biggest first.