Endpoint
Zwraca kompletne drzewo katalogu: kategorie oraz produkty (symbole) z nazwami w wielu językach, opisami, typami elementów. Odpowiedź zawiera kolekcję Elements, które mogą mieć zagnieżdżone Elements (podkategorie / grupy).
Request
-
Accept stringPossible values: application/json
Oczekiwany typ odpowiedzi.
Default value: application/json
Response
{
"Elements": [
{
"Id": 0,
"DescriptiveName": "Root",
"Key": "0",
"Name": [
{ "LangSymbol": "PL", "Value": "Root" }
],
"Description": [],
"Picture": "",
"Products": [],
"Elements": [
{
"Id": 527865,
"DescriptiveName": "Wszystkie",
"Key": "1",
"Name": [
{ "LangSymbol": "EN", "Value": "All products" },
{ "LangSymbol": "PL", "Value": "Wszystkie produkty" }
],
"Description": [],
"Picture": "",
"Products": [],
"Elements": [
{
"Id": 101675,
"DescriptiveName": "Ultra",
"Key": "101675",
"Name": [
{ "LangSymbol": "EN", "Value": "Ultra" },
{ "LangSymbol": "PL", "Value": "Ultra" }
],
"Description": [
{ "LangSymbol": "EN", "Value": "chair polished aluminium base" },
{ "LangSymbol": "PL", "Value": "krzesło podstawa aluminium polerowane" }
],
"Picture": "",
"Products": [
{ "Symbol": "UFBPP19", "DirectDigital": 1 },
{ "Symbol": "UFPP19K", "DirectDigital": 1 }
],
"Elements": [],
"Type": 4,
"TypeName": "Symbol wirtualny",
"DirectDigital": 1,
"JoinID": 0,
"IsMain": 1,
"IsHidden": 0,
"MainKeyForElement": 101675,
"InvisibleOnPricelist": 0,
"InvisibleOnPricelistCurrencies": [ "SEK" ]
}
],
"Type": 1,
"TypeName": "Kategoria",
"DirectDigital": 1,
"JoinID": 0,
"IsMain": 0,
"IsHidden": 0,
"MainKeyForElement": 1,
"InvisibleOnPricelist": 0,
"InvisibleOnPricelistCurrencies": []
}
],
"Type": 0,
"TypeName": "Root",
"DirectDigital": 1,
"JoinID": 0,
"IsMain": 0,
"IsHidden": 0,
"MainKeyForElement": 0,
"InvisibleOnPricelist": 0,
"InvisibleOnPricelistCurrencies": []
}
]
}
-
Elements array<object> Required
Lista elementów drzewa katalogu (kategorie, grupy, wirtualne symbole, itp.).
-
Elements[].Id integer Required
Identyfikator elementu w bazie.
-
Elements[].DescriptiveName string|null
Opisowa nazwa elementu (często bardziej „słownikowa” niż Name[].Value).
-
Elements[].Key string Required
Abstrakcyjny klucz elementu (ciąg znaków używany w katalogu).
-
Elements[].Name array<object>
Nazwy elementu w różnych językach.
-
Elements[].Name[].LangSymbol string RequiredPossible values: PL EN DE ES FR IT
Kod języka (dwuliterowy, np. PL, EN, DE).
-
Elements[].Name[].Value string Required
Nazwa elementu w danym języku.
-
Elements[].Description array<object>
Opisy elementu w różnych językach.
-
Elements[].Description[].LangSymbol string RequiredPossible values: PL EN DE ES FR IT
Kod języka opisu.
-
Elements[].Description[].Value string Required
Opis w danym języku (może być pusty).
-
Elements[].Picture string
URL obrazka powiązanego z elementem (jeśli istnieje).
-
Elements[].Products array<object>
Lista produktów (symbole) powiązanych z elementem (np. z kategorią / rodziną).
-
Elements[].Products[].Symbol string Required
Symbol produktu (SKU).
-
Elements[].Products[].DirectDigital integer RequiredPossible values: 0 1
Flaga dostępności symbolu w Direct Digital (0 – nie, 1 – tak).
-
Elements[].Elements array<object>
Zagnieżdżone elementy (podkategorie / grupy / węzły drzewa) o tej samej strukturze jak Elements[].
-
Elements[].Type integer Required
Kod typu elementu (np. root, kategoria, symbol wirtualny – dokładne znaczenie po stronie systemu).
-
Elements[].TypeName string Required
Nazwa typu elementu (np. „Root”, „Symbol wirtualny”, „Kategoria”).
-
Elements[].DirectDigital integerPossible values: 0 1
Flaga, czy dany element (gałąź) jest dostępny w Direct Digital.
-
Elements[].JoinID integer
Id elementu, z którym ten jest powiązany (np. „oryginalny” rekord).
Default value: 0 -
Elements[].IsMain integerPossible values: 0 1
Czy element jest głównym elementem (1 – tak, 0 – nie).
Default value: 0 -
Elements[].IsHidden integerPossible values: 0 1
Czy element powinien być ukryty na stronie (1 – ukryty, 0 – widoczny).
Default value: 0 -
Elements[].MainKeyForElement integer
Klucz elementu nadrzędnego / głównego, jeśli ten nie jest główny.
Default value: 0 -
Elements[].InvisibleOnPricelist integerPossible values: 0 1
Czy element ma być niewidoczny na cenniku (1 – ukryty, 0 – widoczny).
Default value: 0 -
Elements[].InvisibleOnPricelistCurrencies array<string>
Lista kodów walut, dla których element ma być ukryty na cenniku.
{
"status": 500,
"error": "server_error",
"message": "Wystąpił błąd serwera."
}
Implementation
Przykłady wywołania endpointu (anonimowe GET, bez nagłówka Authorization) dla /externalapi/categories.
<?php
declare(strict_types=1);
$endpoint = 'https://external-api.mddlinx.com/externalapi/categories';
$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_HTTPGET => true,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
]);
$body = curl_exec($ch);
$errno = curl_errno($ch);
$error = curl_error($ch);
$http = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($errno) {
throw new RuntimeException($error);
}
if ($http < 200 || $http >= 300) {
throw new RuntimeException('HTTP ' . $http . ': ' . $body);
}
$data = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
print_r($data);
<?php
use Illuminate\Support\Facades\Http;
$endpoint = 'https://external-api.mddlinx.com/externalapi/categories';
$response = Http::acceptJson()
->timeout(60)
->get($endpoint);
if ($response->failed()) {
throw new RuntimeException('HTTP ' . $response->status() . ': ' . $response->body());
}
$tree = $response->json();
print_r($tree);
const endpoint = 'https://external-api.mddlinx.com/externalapi/categories';
(async () => {
const res = await fetch(endpoint, {
method: 'GET',
headers: {
'Accept': 'application/json'
}
});
if (!res.ok) {
throw new Error('HTTP ' + res.status + ': ' + (await res.text()));
}
const data = await res.json();
console.log(data);
})();
import requests
endpoint = 'https://external-api.mddlinx.com/externalapi/categories'
r = requests.get(
endpoint,
headers={
'Accept': 'application/json',
},
timeout=60,
)
r.raise_for_status()
print(r.json())
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var endpoint = "https://external-api.mddlinx.com/externalapi/categories";
using var http = new HttpClient();
http.DefaultRequestHeaders.Accept.ParseAdd("application/json");
var res = await http.GetAsync(endpoint);
var body = await res.Content.ReadAsStringAsync();
if (!res.IsSuccessStatusCode)
throw new Exception("HTTP " + (int)res.StatusCode + ": " + body);
Console.WriteLine(body);
}
}