Regeln
GARAN-Regeln geben allen passenden Produkten eine Herstellergarantie in Jahren. Pro und Agentur.
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.
Regeln auflisten
GET /v1/shops/{shop}/rules
Schlüssel: Secret Key
Parameter
| Name | Ort | Typ | Beschreibung |
|---|---|---|---|
shopPflicht | path | string | Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$ |
Anfrage
curl "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/rules" \
-H "Authorization: Bearer $GARANIFY_SECRET_KEY"import { Garanify } from '@garanify/sdk';
const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const rules = await garanify.rules.list();<?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]);
$rules = $garanify->rules->list();import os, requests
res = requests.get(
"https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/rules",
headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
timeout=10,
)
res.raise_for_status()
data = res.json()Ausprobieren GET /v1/shops/{shop}/rules
Antwort 200 application/json
{
"data": [
{
"match": {
"brand": "Bosch"
},
"years": 5
},
{
"match": {
"category": "Coffee machines"
},
"years": 3
}
]
} Antworten
200Rules in order. The first matching rule applies. ·RuleList401Key missing, invalid, expired or revoked. ·Problem429Too many requests. Wait `Retry-After` seconds. ·Problem
Alle Regeln ersetzen
PUT /v1/shops/{shop}/rules
Schlüssel: Secret Key
Ersetzt die geordnete Liste der Regeln. Produktwerte gehen immer vor. Pro und Agentur; in Free wirken vorhandene Regeln weiter, lassen sich aber nicht ändern.
Parameter
| Name | Ort | Typ | Beschreibung |
|---|---|---|---|
shopPflicht | path | string | Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$ |
Body
| Name | Typ | Beschreibung |
|---|---|---|
dataPflicht | Rule[] | 0–200 items |
data[].matchPflicht | RuleMatch | All given conditions must match (case-insensitive). A category condition also matches parent categories. |
data[].yearsPflicht | number | > 2, ≤ 99, × 0.5 |
Anfrage
curl -X PUT "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/rules" \
-H "Authorization: Bearer $GARANIFY_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"data":[{"match":{"brand":"Bosch"},"years":5},{"match":{"category":"Coffee machines","tag":"premium"},"years":3}]}'import { Garanify } from '@garanify/sdk';
const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const rules = await garanify.rules.replace([
{
match: {
brand: 'Bosch'
},
years: 5
},
{
match: {
category: 'Coffee machines',
tag: 'premium'
},
years: 3
}
]);<?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]);
$rules = $garanify->rules->replace([
[
'match' => [
'brand' => 'Bosch',
],
'years' => 5,
],
[
'match' => [
'category' => 'Coffee machines',
'tag' => 'premium',
],
'years' => 3,
],
]);import os, requests
res = requests.put(
"https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/rules",
headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
json={
"data": [
{
"match": {
"brand": "Bosch",
},
"years": 5,
},
{
"match": {
"category": "Coffee machines",
"tag": "premium",
},
"years": 3,
},
],
},
timeout=10,
)
res.raise_for_status()
data = res.json()Ausprobieren PUT /v1/shops/{shop}/rules
Antworten
200Stored rules. ·RuleList401Key missing, invalid, expired or revoked. ·Problem403Plan, key type or origin does not allow the request. ·Problem422The request does not match the schema. ·Problem429Too many requests. Wait `Retry-After` seconds. ·Problem