Auflösung
Welches Etikett für ein Produkt gilt und warum.
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.
Gespeichertes Produkt auflösen
GET /v1/shops/{shop}/products/{sku}/resolve
Schlüssel: Secret Key
Welches Etikett das Produkt zeigt und warum. Reihenfolge: Produktwert, dann Hauptprodukt (Varianten), dann die erste passende Regel.
Parameter
| Name | Ort | Typ | Beschreibung |
|---|---|---|---|
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 |
Anfrage
curl "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/products/WCR870/resolve?lang=de" \
-H "Authorization: Bearer $GARANIFY_SECRET_KEY"import { Garanify } from '@garanify/sdk';
const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const resolution = await garanify.products.resolve('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]);
$resolution = $garanify->products->resolve('WCR870', 'de');import os, requests
res = requests.get(
"https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/products/WCR870/resolve?lang=de",
headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
timeout=10,
)
res.raise_for_status()
data = res.json()Ausprobieren GET /v1/shops/{shop}/products/{sku}/resolve
Antwort 200 application/json
{
"sku": "WAN28200",
"lang": "de",
"label": {
"years": 5,
"brand": "Bosch",
"model": "WAN28200",
"source": "rule",
"rule": 1,
"text": "GARAN – Herstellergarantie in Jahren: 5 (Bosch WAN28200)"
},
"reason": {
"code": "rule",
"rule": 1,
"detail": "Rule 1 applies (5 years)."
},
"errors": []
} Antworten
200Resolution. ·Resolution401Key missing, invalid, expired or revoked. ·Problem404Not found. ·Problem429Too many requests. Wait `Retry-After` seconds. ·Problem
Auflösen ohne Speichern
POST /v1/shops/{shop}/resolve
Schlüssel: Secret Key
Löst ein Produkt mit den Regeln des Shops auf, ohne es zu speichern. Gut für Vorschauen in Ihrem Admin.
Parameter
| Name | Ort | Typ | Beschreibung |
|---|---|---|---|
shopPflicht | path | string | Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$ |
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 |
Body
| Name | Typ | Beschreibung |
|---|---|---|
parentSku | Sku | null | SKU of the main product, for variants. |
name | string | null | ≤ 300 chars |
brand | string | null | Brand or manufacturer.≤ 120 chars |
mpn | string | null | Manufacturer part number. Preferred model identifier. Not a GTIN/EAN.≤ 120 chars |
categories | string[] | Category names. A path like Household > Coffee machines also matches its parent categories.0–50 items |
tags | string[] | 0–50 items |
garan | GaranInput | Producer guarantee of the product. Empty values come from the main product or the rules. |
garan.years | number | null | Years, more than 2, whole or half years. 0 or null = not set (main product or rules apply).≥ 0, ≤ 99 |
garan.brand | string | null | Brand on the label. Default is brand of the product.≤ 120 chars |
garan.model | string | null | Model identifier on the label. Default is MPN, then SKU.≤ 120 chars |
hidden | boolean | true = never show a GARAN label for this product. |
skuPflicht | Sku | 1–120 chars, pattern ^[^\x00-\x1f]+$ |
Anfrage
curl -X POST "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/resolve" \
-H "Authorization: Bearer $GARANIFY_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"sku":"PREVIEW-1","brand":"Bosch","mpn":"WAN28200","garan":{"years":2}}'import { Garanify } from '@garanify/sdk';
const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const resolution = await garanify.products.preview({
sku: 'PREVIEW-1',
brand: 'Bosch',
mpn: 'WAN28200',
garan: {
years: 2
}
});<?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]);
$resolution = $garanify->products->preview([
'sku' => 'PREVIEW-1',
'brand' => 'Bosch',
'mpn' => 'WAN28200',
'garan' => [
'years' => 2,
],
]);import os, requests
res = requests.post(
"https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/resolve",
headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
json={
"sku": "PREVIEW-1",
"brand": "Bosch",
"mpn": "WAN28200",
"garan": {
"years": 2,
},
},
timeout=10,
)
res.raise_for_status()
data = res.json()Ausprobieren POST /v1/shops/{shop}/resolve
Antwort 200 application/json
{
"sku": "PREVIEW-1",
"lang": "en",
"label": null,
"reason": {
"code": "invalid",
"rule": null,
"detail": "The guarantee data is invalid."
},
"errors": [
{
"code": "years_too_low",
"message": "GARAN only for producer guarantees of more than 2 years."
}
]
} Antworten
200Resolution. ·Resolution401Key missing, invalid, expired or revoked. ·Problem422The request does not match the schema. ·Problem429Too many requests. Wait `Retry-After` seconds. ·Problem