Zum Inhalt springen
Garanify

Darstellung

Die offizielle Mitteilung und das GARAN-Etikett als SVG, PNG oder HTML-Fragment.

Die API ist gebaut und getestet. Das Hosting unter api.garanify.com ist in Vorbereitung; bis dahin läuft sie lokal. Schlüssel gibt es auf Anfrage.

Feldbeschreibungen auf Englisch, direkt aus der OpenAPI-Datei.

Etikett eines Produkts darstellen

GET /v1/shops/{shop}/products/{sku}/garan

Schlüssel: Secret Key / Publishable Key

Das GARAN-Etikett eines gespeicherten Produkts. 404 mit product_not_found, wenn es das Produkt nicht gibt, 204, wenn es kein Etikett zeigt.

Parameter

NameOrtTypBeschreibung
shopPflicht path string Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$
skuPflicht path Sku Your product ID, usually the SKU. URL-encode special characters.1–120 chars, pattern ^[^\x00-\x1f]+$
lang query string Language of texts and notice. Locales such as de-AT are mapped to one of the 24 EU languages; unknown languages fall back to the default language of the shop, then English.≤ 16 chars
display query "full" | "nested" full = large label (product page, at most once per page), nested = small label for cart lines; in HTML it links to the large label.default "full"
format query "svg" | "html" default "svg"

Anfrage

curl "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/products/WCR870/garan?lang=de" \
  -H "Authorization: Bearer $GARANIFY_SECRET_KEY"
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const svg = await garanify.products.renderGaran('WCR870', {
  lang: 'de'
});
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$svg = $garanify->products->renderGaran('WCR870', [
    'lang' => 'de',
]);
import os, requests

res = requests.get(
    "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/products/WCR870/garan?lang=de",
    headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
    timeout=10,
)
res.raise_for_status()

Antwort 200 image/svg+xml

<svg role="img" aria-label="GARAN – Producer guarantee in years: 5 (Bosch WAN28200)" …>…</svg>

Antworten

  • 200 The label.
  • 204 The product shows no label.
  • 401 Key missing, invalid, expired or revoked. · Problem
  • 404 Not found. · Problem
  • 429 Too many requests. Wait `Retry-After` seconds. · Problem

GARAN-Etikett aus Werten darstellen

GET /v1/render/garan

Schlüssel: keiner

Stellt das offizielle Etikett für die Werte dar, ohne Schlüssel (wie der Etikett-Generator der Website). Ungültige Werte: validation_failed mit Grund. Das verschachtelte HTML-Fragment verlinkt das große Etikett dieses Endpunkts.

Parameter

NameOrtTypBeschreibung
yearsPflicht query number Producer guarantee in years, more than 2, whole or half years.
brandPflicht query string 1–120 chars
modelPflicht query string 1–120 chars
lang query string Language of texts and notice. Locales such as de-AT are mapped to one of the 24 EU languages; unknown languages fall back to the default language of the shop, then English.≤ 16 chars
display query "full" | "nested" full = large label (product page, at most once per page), nested = small label for cart lines; in HTML it links to the large label.default "full"
format query "svg" | "html" default "svg"

Anfrage

curl "https://api.garanify.com/v1/render/garan?years=5&brand=Bosch&model=WAN28200&lang=de"
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const svg = await garanify.render.garan({
  years: 5,
  brand: 'Bosch',
  model: 'WAN28200',
  lang: 'de'
});
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$svg = $garanify->render->garan([
    'years' => 5,
    'brand' => 'Bosch',
    'model' => 'WAN28200',
    'lang' => 'de',
]);
import os, requests

res = requests.get(
    "https://api.garanify.com/v1/render/garan?years=5&brand=Bosch&model=WAN28200&lang=de",
    timeout=10,
)
res.raise_for_status()

Antwort 200 image/svg+xml

<svg role="img" aria-label="GARAN – Producer guarantee in years: 5 (Bosch WAN28200)" …>…</svg>

Antworten

  • 200 The label.
  • 422 The request does not match the schema. · Problem
  • 429 Too many requests. Wait `Retry-After` seconds. · Problem

Mitteilung darstellen

GET /v1/render/notice

Schlüssel: keiner

Die offizielle Mitteilung (Anhang I), unverändert und farbig. png (1200 px breit) für Websites, svg ist die Originaldatei der Kommission für den Druck (etwa 600 KB), html ein <img>-Fragment mit dem offiziellen Titel als Alternativtext.

Parameter

NameOrtTypBeschreibung
lang query string Language of texts and notice. Locales such as de-AT are mapped to one of the 24 EU languages; unknown languages fall back to the default language of the shop, then English.≤ 16 chars
format query "png" | "svg" | "html" default "png"
maxWidth query integer Only for html. Maximum width in pixels.≥ 120, ≤ 1200, default 480

Anfrage

curl "https://api.garanify.com/v1/render/notice?lang=de&format=png"
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const png = await garanify.render.notice({
  lang: 'de',
  format: 'png'
});
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$png = $garanify->render->notice([
    'lang' => 'de',
    'format' => 'png',
]);
import os, requests

res = requests.get(
    "https://api.garanify.com/v1/render/notice?lang=de&format=png",
    timeout=10,
)
res.raise_for_status()

Antwort 200 image/png

(binary PNG, 1200 px wide)

Antworten

  • 200 The notice.
  • 422 The request does not match the schema. · Problem
  • 429 Too many requests. Wait `Retry-After` seconds. · Problem

Schriftdatei für HTML-Fragmente

GET /v1/assets/fonts/{file}

Schlüssel: keiner

Inter (SIL OFL) für die Texte im GARAN-Etikett. HTML-Fragmente verweisen auf diese Dateien.

Parameter

NameOrtTypBeschreibung
filePflicht path string pattern ^inter-(latin|latin-ext|greek|cyrillic)-(400|800)-normal\.woff2$

Anfrage

curl "https://api.garanify.com/v1/assets/fonts/inter-latin-400-normal.woff2"
const res = await fetch('https://api.garanify.com/v1/assets/fonts/inter-latin-400-normal.woff2');
const bytes = await res.arrayBuffer();
<?php
$font = file_get_contents('https://api.garanify.com/v1/assets/fonts/inter-latin-400-normal.woff2');
import os, requests

res = requests.get(
    "https://api.garanify.com/v1/assets/fonts/inter-latin-400-normal.woff2",
    timeout=10,
)
res.raise_for_status()

Antwort 200 font/woff2

(binary font)

Antworten

  • 200 The font.
  • 404 Not found. · Problem
  • 422 The request does not match the schema. · Problem
  • 429 Too many requests. Wait `Retry-After` seconds. · Problem

Weiter: Öffentlich