Aller au contenu
Garanify

Render

The official notice and GARAN label as SVG, PNG or HTML fragment.

The API is built and tested. Hosting at api.garanify.com is in preparation; until then it runs locally. Keys are available on request.

Render the label of a product

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

Key: Secret key / Publishable key

The GARAN label of a stored product. 404 with product_not_found if the product does not exist, 204 if it shows no label.

Parameters

NameInTypeDescription
shoprequired path string Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$
skurequired 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"

Request

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()

Response 200 image/svg+xml

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

Responses

  • 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

Render a GARAN label from values

GET /v1/render/garan

Key: none

Renders the official GARAN label for the given values, without a key (like the label generator on the website). Invalid values return validation_failed with the reason. The nested HTML fragment links to the large label of this endpoint.

Parameters

NameInTypeDescription
yearsrequired query number Producer guarantee in years, more than 2, whole or half years.
brandrequired query string 1–120 chars
modelrequired 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"

Request

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()

Response 200 image/svg+xml

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

Responses

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

Render the notice

GET /v1/render/notice

Key: none

The official notice on the legal guarantee (Annex I), unchanged, in colour. png (1200 px wide) is the format for websites, svg is the original vector file of the Commission for print (about 600 KB), html is an <img> fragment with the official title as alternative text.

Parameters

NameInTypeDescription
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

Request

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()

Response 200 image/png

(binary PNG, 1200 px wide)

Responses

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

Font file for HTML fragments

GET /v1/assets/fonts/{file}

Key: none

Inter (SIL OFL) for the texts on the GARAN label. HTML fragments reference these files.

Parameters

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

Request

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()

Response 200 font/woff2

(binary font)

Responses

  • 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

Next: Public