Tested partner API examples
Keep SNIFF_PARTNER_KEY in your server environment. Each sample states prerequisites. These requests were tested against local route handlers with synthetic data; production deployment and your business access are separate acceptance checks.
getWhoami
- curl
- Node
- PHP
curl
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request GET --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/whoami'
node
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/whoami", { method: "GET", headers: { Authorization: "Bearer " + key } });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
php
<?php
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/whoami');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key]]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;
getCapabilities
- curl
- Node
- PHP
curl
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request GET --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/capabilities'
node
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/capabilities", { method: "GET", headers: { Authorization: "Bearer " + key } });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
php
<?php
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/capabilities');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key]]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;
getCard
- curl
- Node
- PHP
curl
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request GET --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/fragrances/03c188b7-74aa-469d-ae40-caa8c45673b7/card'
curl PNG
# Save a square look named Square in your workspace before running this example.
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request GET --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/fragrances/03c188b7-74aa-469d-ae40-caa8c45673b7/card?look=Square&format=png'
node
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/fragrances/03c188b7-74aa-469d-ae40-caa8c45673b7/card", { method: "GET", headers: { Authorization: "Bearer " + key } });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
node PNG
// Save a square look named Square in your workspace before running this example.
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/fragrances/03c188b7-74aa-469d-ae40-caa8c45673b7/card?look=Square&format=png", { method: "GET", headers: { Authorization: "Bearer " + key } });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
php
<?php
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/fragrances/03c188b7-74aa-469d-ae40-caa8c45673b7/card');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key]]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;
php PNG
<?php
// Save a square look named Square in your workspace before running this example.
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/fragrances/03c188b7-74aa-469d-ae40-caa8c45673b7/card?look=Square&format=png');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key]]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;
getProductCard
- curl
- Node
- PHP
curl
# Approve product-1 in your business account before running this example.
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request GET --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/products/product-1/card'
curl
# Approve product-1 in your business account before running this example.
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request GET --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/products/product-1/card?format=html'
node
// Approve product-1 in your business account before running this example.
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/products/product-1/card", { method: "GET", headers: { Authorization: "Bearer " + key } });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
node
// Approve product-1 in your business account before running this example.
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/products/product-1/card?format=html", { method: "GET", headers: { Authorization: "Bearer " + key } });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
php
<?php
// Approve product-1 in your business account before running this example.
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/products/product-1/card');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key]]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;
php
<?php
// Approve product-1 in your business account before running this example.
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/products/product-1/card?format=html');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key]]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;
searchPerfumes
- curl
- Node
- PHP
curl
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request GET --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/search?q=casafutura+xerjoff'
node
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/search?q=casafutura+xerjoff", { method: "GET", headers: { Authorization: "Bearer " + key } });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
php
<?php
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/search?q=casafutura+xerjoff');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key]]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;
matchProducts
- curl
- Node
- PHP
curl
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request POST --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --header 'Content-Type: application/json' --data '{"rows":[{"ref":"product-1","brand":"Xerjoff","name":"Casafutura","strength":"Eau de Parfum"},{"ref":"product-2","brand":"Dior","name":"Sauvage"},{"ref":"product-3","name":"A perfume that is not recorded"}]}' --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/match'
node
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/match", { method: "POST", headers: { Authorization: "Bearer " + key, "Content-Type": "application/json" }, body: "{\"rows\":[{\"ref\":\"product-1\",\"brand\":\"Xerjoff\",\"name\":\"Casafutura\",\"strength\":\"Eau de Parfum\"},{\"ref\":\"product-2\",\"brand\":\"Dior\",\"name\":\"Sauvage\"},{\"ref\":\"product-3\",\"name\":\"A perfume that is not recorded\"}]}" });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
php
<?php
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/match');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key, 'Content-Type: application/json'], CURLOPT_POSTFIELDS => '{"rows":[{"ref":"product-1","brand":"Xerjoff","name":"Casafutura","strength":"Eau de Parfum"},{"ref":"product-2","brand":"Dior","name":"Sauvage"},{"ref":"product-3","name":"A perfume that is not recorded"}]}']);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;
listLooks
- curl
- Node
- PHP
curl
# For a terminal session, paste at the silent prompt: read -rs SNIFF_PARTNER_KEY
curl --silent --show-error --fail-with-body --request GET --header "Authorization: Bearer ${SNIFF_PARTNER_KEY:?Set SNIFF_PARTNER_KEY in your server environment}" --write-out '
%{http_code}' 'https://www.sniffopotamus.com/api/partner/v1/looks'
node
const key = process.env.SNIFF_PARTNER_KEY;
if (!key) throw new Error("Set SNIFF_PARTNER_KEY in your server environment");
const res = await fetch("https://www.sniffopotamus.com/api/partner/v1/looks", { method: "GET", headers: { Authorization: "Bearer " + key } });
if (res.headers.get("content-type")?.includes("image/png")) { process.stdout.write(Buffer.from(await res.arrayBuffer())); process.stdout.write(String.fromCharCode(10)); }
else console.log(await res.text());
console.log(res.status);
php
<?php
$key = getenv('SNIFF_PARTNER_KEY');
if (!$key) throw new RuntimeException('Set SNIFF_PARTNER_KEY in your server environment');
$ch = curl_init('https://www.sniffopotamus.com/api/partner/v1/looks');
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $key]]);
$body = curl_exec($ch);
if ($body === false) throw new RuntimeException(curl_error($ch));
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body . PHP_EOL;
echo $status . PHP_EOL;