Kategorie
Drzewo kategorii i parametry po identyfikatorach Allegro, podpowiedź kategorii, zmiany drzewa.
Lista kategorii
GET /sale/categories
zgodna z Allegrolimit: read
Działy główne albo dzieci wskazanej kategorii (parent.id = identyfikator Allegro). Każda kategoria ma oba identyfikatory: id (Allegro) i alleeId.
Wystarczy dowolny ważny token — także token aplikacji (client_credentials).
Zgodność: zgodna z Allegro REST API (ten sam kształt) — GET /sale/categories.
Uprawnienie: dowolny ważny token lub klucz (działa też token aplikacji client_credentials).
Grupa limitu: read.
Parametry zapytania
parent.id stringIdentyfikator kategorii nadrzędnej (Allegro). Brak = działy główne.
Odpowiedzi
200 Kategorie. · CategoryList
categories array<Category> zawszePola obiektu
id string zawszeIdentyfikator Allegro.
alleeId integer zawszeIdentyfikator allee.
name string zawszeparent object · null zawszeKategoria nadrzędna; null dla działu głównego.
Pola obiektu
id string · null zawszealleeId integer zawszeleaf boolean zawszeCzy to kategoria najniższego poziomu (tylko w liściu można wystawić ofertę).
options object zawszeZawsze {} (zgodność z Allegro).
Błędy
| HTTP | Kod | Znaczenie |
|---|---|---|
| 401 | invalid_token | Brak, zły, wygasły albo odwołany token lub klucz (format OAuth, nagłówek WWW-Authenticate). |
| 403 | ACCOUNT_INACTIVE | Konto sprzedawcy jest nieaktywne. |
| 403 | AccessDenied | Brak zakresu albo zasób innego sprzedawcy. |
| 403 | KEY_QUARANTINED | Kwarantanna: działa tylko odczyt (wykryto nietypowe użycie). |
| 403 | KEY_SUSPENDED | Klucz albo dostęp aplikacji wstrzymany (przez sprzedawcę albo ochronę). |
| 404 | CATEGORY_NOT_FOUND | Nie ma takiej kategorii. |
| 429 | TOO_MANY_REQUESTS | Przekroczony limit (minutowy, grupy operacji albo IP). |
| 500 | INTERNAL_ERROR | Błąd serwera allee. |
curl -sS -X GET "${ALLEE_API_URL:-https://api.allee.pl}/sale/categories?parent.id=38d588fd-7e9c-4c42-a4ae-6831775eca45" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-w '\nHTTP %{http_code}\n'<?php
// allee API: GET /sale/categories (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$ch = curl_init($base . '/sale/categories?parent.id=38d588fd-7e9c-4c42-a4ae-6831775eca45');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
],
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: GET /sale/categories (Python 3, biblioteka requests)
import os
import requests
BASE = os.environ.get("ALLEE_API_URL", "https://api.allee.pl")
headers = {
"Authorization": "Bearer " + os.environ["ALLEE_API_KEY"],
"Accept": "application/vnd.allegro.public.v1+json",
}
r = requests.request("GET", BASE + "/sale/categories?parent.id=38d588fd-7e9c-4c42-a4ae-6831775eca45", headers=headers, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: GET /sale/categories (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const res = await fetch(`${BASE}/sale/categories?parent.id=38d588fd-7e9c-4c42-a4ae-6831775eca45`, {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
},
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: GET /sale/categories (C#, .NET 8+, HttpClient)
using System.Net.Http.Headers;
using System.Text;
var baseUrl = Environment.GetEnvironmentVariable("ALLEE_API_URL") ?? "https://api.allee.pl";
using var http = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false });
using var req = new HttpRequestMessage(new HttpMethod("GET"), baseUrl + "/sale/categories?parent.id=38d588fd-7e9c-4c42-a4ae-6831775eca45");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
using var res = await http.SendAsync(req);
Console.WriteLine($"HTTP {(int)res.StatusCode}");
Console.WriteLine(await res.Content.ReadAsStringAsync());// allee API: GET /sale/categories (Java 11+, java.net.http; uruchom: java Main.java)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String base = System.getenv().getOrDefault("ALLEE_API_URL", "https://api.allee.pl");
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/categories?parent.id=38d588fd-7e9c-4c42-a4ae-6831775eca45"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpClient http = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
HttpResponse<String> res = http.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println("HTTP " + res.statusCode());
System.out.println(res.body());
}
}// allee API: GET /sale/categories (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
req, err := http.NewRequest("GET", base+"/sale/categories?parent.id=38d588fd-7e9c-4c42-a4ae-6831775eca45", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ALLEE_API_KEY"))
req.Header.Set("Accept", "application/vnd.allegro.public.v1+json")
klient := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
res, err := klient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
dane, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println("HTTP", res.StatusCode)
fmt.Println(string(dane))
}application/vnd.allegro.public.v1+json{
"categories": [
{
"id": "66813",
"alleeId": 17,
"name": "Audiobooki - CD",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "253753",
"alleeId": 18,
"name": "Audiobooki - mp3",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "300881",
"alleeId": 20,
"name": "Bilety",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "118",
"alleeId": 25,
"name": "Czasopisma",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "5893",
"alleeId": 32,
"name": "Ebooki",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "20585",
"alleeId": 35,
"name": "Filmy",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": true,
"options": {}
},
{
"id": "306453",
"alleeId": 38,
"name": "Gadżety",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "9",
"alleeId": 39,
"name": "Gry",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "122640",
"alleeId": 44,
"name": "Instrumenty",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "28496",
"alleeId": 45,
"name": "Kalendarze, notesy, planery",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "257900",
"alleeId": 47,
"name": "Kody i doładowania",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "79413",
"alleeId": 50,
"name": "Komiksy",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "7",
"alleeId": 54,
"name": "Książki",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "325021",
"alleeId": 57,
"name": "Mapy, atlasy",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": true,
"options": {}
},
{
"id": "1",
"alleeId": 63,
"name": "Muzyka",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": true,
"options": {}
},
{
"id": "66820",
"alleeId": 75,
"name": "Podręczniki szkolne",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": false,
"options": {}
},
{
"id": "301130",
"alleeId": 109,
"name": "Wyjątkowe chwile",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": true,
"options": {}
}
]
}Kategoria
GET /sale/categories/{categoryId}
zgodna z Allegrolimit: read
Jedna kategoria po identyfikatorze Allegro. leaf: true = można w niej wystawiać.
Zgodność: zgodna z Allegro REST API (ten sam kształt) — GET /sale/categories/{categoryId}.
Uprawnienie: dowolny ważny token lub klucz (działa też token aplikacji client_credentials).
Grupa limitu: read.
Parametry ścieżki
categoryId string wymaganyIdentyfikator kategorii Allegro (liczba albo UUID).
Odpowiedzi
200 Kategoria. · Category
id string zawszeIdentyfikator Allegro.
alleeId integer zawszeIdentyfikator allee.
name string zawszeparent object · null zawszeKategoria nadrzędna; null dla działu głównego.
Pola obiektu
id string · null zawszealleeId integer zawszeleaf boolean zawszeCzy to kategoria najniższego poziomu (tylko w liściu można wystawić ofertę).
options object zawszeZawsze {} (zgodność z Allegro).
Błędy
| HTTP | Kod | Znaczenie |
|---|---|---|
| 401 | invalid_token | Brak, zły, wygasły albo odwołany token lub klucz (format OAuth, nagłówek WWW-Authenticate). |
| 403 | ACCOUNT_INACTIVE | Konto sprzedawcy jest nieaktywne. |
| 403 | AccessDenied | Brak zakresu albo zasób innego sprzedawcy. |
| 403 | KEY_QUARANTINED | Kwarantanna: działa tylko odczyt (wykryto nietypowe użycie). |
| 403 | KEY_SUSPENDED | Klucz albo dostęp aplikacji wstrzymany (przez sprzedawcę albo ochronę). |
| 404 | CATEGORY_NOT_FOUND | Nie ma takiej kategorii. |
| 429 | TOO_MANY_REQUESTS | Przekroczony limit (minutowy, grupy operacji albo IP). |
| 500 | INTERNAL_ERROR | Błąd serwera allee. |
curl -sS -X GET "${ALLEE_API_URL:-https://api.allee.pl}/sale/categories/20585" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-w '\nHTTP %{http_code}\n'<?php
// allee API: GET /sale/categories/20585 (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$ch = curl_init($base . '/sale/categories/20585');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
],
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: GET /sale/categories/20585 (Python 3, biblioteka requests)
import os
import requests
BASE = os.environ.get("ALLEE_API_URL", "https://api.allee.pl")
headers = {
"Authorization": "Bearer " + os.environ["ALLEE_API_KEY"],
"Accept": "application/vnd.allegro.public.v1+json",
}
r = requests.request("GET", BASE + "/sale/categories/20585", headers=headers, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: GET /sale/categories/20585 (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const res = await fetch(`${BASE}/sale/categories/20585`, {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
},
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: GET /sale/categories/20585 (C#, .NET 8+, HttpClient)
using System.Net.Http.Headers;
using System.Text;
var baseUrl = Environment.GetEnvironmentVariable("ALLEE_API_URL") ?? "https://api.allee.pl";
using var http = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false });
using var req = new HttpRequestMessage(new HttpMethod("GET"), baseUrl + "/sale/categories/20585");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
using var res = await http.SendAsync(req);
Console.WriteLine($"HTTP {(int)res.StatusCode}");
Console.WriteLine(await res.Content.ReadAsStringAsync());// allee API: GET /sale/categories/20585 (Java 11+, java.net.http; uruchom: java Main.java)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String base = System.getenv().getOrDefault("ALLEE_API_URL", "https://api.allee.pl");
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/categories/20585"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpClient http = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
HttpResponse<String> res = http.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println("HTTP " + res.statusCode());
System.out.println(res.body());
}
}// allee API: GET /sale/categories/20585 (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
req, err := http.NewRequest("GET", base+"/sale/categories/20585", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ALLEE_API_KEY"))
req.Header.Set("Accept", "application/vnd.allegro.public.v1+json")
klient := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
res, err := klient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
dane, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println("HTTP", res.StatusCode)
fmt.Println(string(dane))
}application/vnd.allegro.public.v1+json{
"id": "20585",
"alleeId": 35,
"name": "Filmy",
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6
},
"leaf": true,
"options": {}
}Parametry kategorii
GET /sale/categories/{categoryId}/parameters
Allegro + rozszerzenialimit: read
Parametry kategorii z wymagalnością, typem, ograniczeniami i słownikiem wartości. Słownik bywa węższy niż w Allegro — zawsze bierz go stąd.
Parametr Stan (11323) przyjmujemy w każdej kategorii; wartości obsługiwane przez allee mają options.alleeSupported: true. Listy są buforowane 10 minut.
Zgodność: zgodna z Allegro REST API, z rozszerzeniami allee (pola allee.*, alleeId) — GET /sale/categories/{categoryId}/parameters.
Uprawnienie: dowolny ważny token lub klucz (działa też token aplikacji client_credentials).
Grupa limitu: read.
Parametry ścieżki
categoryId string wymaganyIdentyfikator kategorii Allegro.
Odpowiedzi
200 Parametry. · CategoryParameterList
parameters array<CategoryParameter> zawszePola obiektu
id string zawszeIdentyfikator parametru Allegro.
alleeId integer zawszeIdentyfikator allee.
name string zawszetype string zawszedictionary, integer, float, stringrequired boolean zawszeWymagany w tej kategorii.
requiredForProduct boolean zawszeZawsze false (allee nie ma kart produktów).
unit string · null zawszeJednostka, np. kg.
options object zawszePola obiektu
customValuesEnabled boolean zawszeZawsze false — tylko wartości ze słownika.
ambiguousValueId string · null zawszerestrictions object zawszeOgraniczenia wartości (sprawdzane przy zapisie oferty).
Pola obiektu
multipleChoices booleanCzy wolno wybrać kilka wartości słownika.
minLength integermaxLength integerallowedNumberOfValues integermin numbermax numberrange booleanZawsze false (zakresy nieobsługiwane).
precision integerMiejsca po przecinku (float).
dictionary array<object>Wartości słownika (typ dictionary).
Pola obiektu
id string zawszeIdentyfikator wartości Allegro.
alleeId integer zawszevalue string zawszedependsOnValueIds array<string> zawszePrzekazujemy jak Allegro, nie sprawdzamy przy zapisie.
options objectPola obiektu
alleeSupported boolean zawszeParametr Stan: czy allee przyjmuje tę wartość.
Błędy
| HTTP | Kod | Znaczenie |
|---|---|---|
| 401 | invalid_token | Brak, zły, wygasły albo odwołany token lub klucz (format OAuth, nagłówek WWW-Authenticate). |
| 403 | ACCOUNT_INACTIVE | Konto sprzedawcy jest nieaktywne. |
| 403 | AccessDenied | Brak zakresu albo zasób innego sprzedawcy. |
| 403 | KEY_QUARANTINED | Kwarantanna: działa tylko odczyt (wykryto nietypowe użycie). |
| 403 | KEY_SUSPENDED | Klucz albo dostęp aplikacji wstrzymany (przez sprzedawcę albo ochronę). |
| 404 | CATEGORY_NOT_FOUND | Nie ma takiej kategorii. |
| 429 | TOO_MANY_REQUESTS | Przekroczony limit (minutowy, grupy operacji albo IP). |
| 500 | INTERNAL_ERROR | Błąd serwera allee. |
curl -sS -X GET "${ALLEE_API_URL:-https://api.allee.pl}/sale/categories/20585/parameters" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-w '\nHTTP %{http_code}\n'<?php
// allee API: GET /sale/categories/20585/parameters (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$ch = curl_init($base . '/sale/categories/20585/parameters');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
],
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: GET /sale/categories/20585/parameters (Python 3, biblioteka requests)
import os
import requests
BASE = os.environ.get("ALLEE_API_URL", "https://api.allee.pl")
headers = {
"Authorization": "Bearer " + os.environ["ALLEE_API_KEY"],
"Accept": "application/vnd.allegro.public.v1+json",
}
r = requests.request("GET", BASE + "/sale/categories/20585/parameters", headers=headers, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: GET /sale/categories/20585/parameters (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const res = await fetch(`${BASE}/sale/categories/20585/parameters`, {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
},
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: GET /sale/categories/20585/parameters (C#, .NET 8+, HttpClient)
using System.Net.Http.Headers;
using System.Text;
var baseUrl = Environment.GetEnvironmentVariable("ALLEE_API_URL") ?? "https://api.allee.pl";
using var http = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false });
using var req = new HttpRequestMessage(new HttpMethod("GET"), baseUrl + "/sale/categories/20585/parameters");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
using var res = await http.SendAsync(req);
Console.WriteLine($"HTTP {(int)res.StatusCode}");
Console.WriteLine(await res.Content.ReadAsStringAsync());// allee API: GET /sale/categories/20585/parameters (Java 11+, java.net.http; uruchom: java Main.java)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String base = System.getenv().getOrDefault("ALLEE_API_URL", "https://api.allee.pl");
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/categories/20585/parameters"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpClient http = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
HttpResponse<String> res = http.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println("HTTP " + res.statusCode());
System.out.println(res.body());
}
}// allee API: GET /sale/categories/20585/parameters (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
req, err := http.NewRequest("GET", base+"/sale/categories/20585/parameters", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ALLEE_API_KEY"))
req.Header.Set("Accept", "application/vnd.allegro.public.v1+json")
klient := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
res, err := klient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
dane, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println("HTTP", res.StatusCode)
fmt.Println(string(dane))
}application/vnd.allegro.public.v1+json{
"parameters": [
{
"id": "11323",
"alleeId": 669,
"name": "Stan",
"type": "dictionary",
"required": true,
"requiredForProduct": false,
"unit": null,
"options": {
"customValuesEnabled": false,
"ambiguousValueId": null
},
"restrictions": {
"multipleChoices": false
},
"dictionary": [
{
"id": "11323_1",
"alleeId": 6386,
"value": "Nowy",
"dependsOnValueIds": [],
"options": {
"alleeSupported": true
}
},
{
"id": "11323_2",
"alleeId": 6387,
"value": "Używany",
"dependsOnValueIds": [],
"options": {
"alleeSupported": true
}
}
]
},
{
"id": "246845",
"alleeId": 8973,
"name": "Nośnik",
"type": "dictionary",
"required": true,
"requiredForProduct": false,
"unit": null,
"options": {
"customValuesEnabled": false,
"ambiguousValueId": null
},
"restrictions": {
"multipleChoices": false
},
"dictionary": [
{
"id": "246845_622161",
"alleeId": 79215,
"value": "płyta Blu-ray 3D",
"dependsOnValueIds": []
},
{
"id": "246845_622165",
"alleeId": 79216,
"value": "płyta DVD",
"dependsOnValueIds": []
},
{
"id": "246845_622169",
"alleeId": 79217,
"value": "płyta Blu-ray",
"dependsOnValueIds": []
},
{
"id": "246845_728783",
"alleeId": 79218,
"value": "płyta Blu-ray 4K",
"dependsOnValueIds": []
},
{
"id": "246845_622173",
"alleeId": 79219,
"value": "płyta VCD",
"dependsOnValueIds": []
},
{
"id": "246845_622177",
"alleeId": 79220,
"value": "kaseta wideo",
"dependsOnValueIds": []
},
{
"id": "246845_738593",
"alleeId": 79221,
"value": "płyta DVD+Książka",
"dependsOnValueIds": []
}
]
},
{
"id": "250077",
"alleeId": 10923,
"name": "Gatunek",
"type": "dictionary",
"required": true,
"requiredForProduct": false,
"unit": null,
"options": {
"customValuesEnabled": false,
"ambiguousValueId": null
},
"restrictions": {
"multipleChoices": false
},
"dictionary": [
{
"id": "250077_1797493",
"alleeId": 258674,
"value": "anime",
"dependsOnValueIds": []
},
{
"id": "250077_1797494",
"alleeId": 258675,
"value": "bollywood",
"dependsOnValueIds": []
},
{
"id": "250077_1797495",
"alleeId": 258676,
"value": "dla dzieci",
"dependsOnValueIds": []
},
{
"id": "250077_1797496",
"alleeId": 258677,
"value": "dokumentalne",
"dependsOnValueIds": []
},
{
"id": "250077_1797497",
"alleeId": 258678,
"value": "dramaty",
"dependsOnValueIds": []
},
{
"id": "250077_1797498",
"alleeId": 258679,
"value": "fantasy",
"dependsOnValueIds": []
},
{
"id": "250077_1797499",
"alleeId": 258680,
"value": "horrory",
"dependsOnValueIds": []
},
{
"id": "250077_1797500",
"alleeId": 258681,
"value": "kabarety",
"dependsOnValueIds": []
},
{
"id": "250077_1797501",
"alleeId": 258682,
"value": "komedie",
"dependsOnValueIds": []
},
{
"id": "250077_1797503",
"alleeId": 258683,
"value": "kostiumowe",
"dependsOnValueIds": []
},
{
"id": "250077_1797504",
"alleeId": 258684,
"value": "kryminały",
"dependsOnValueIds": []
},
{
"id": "250077_1797505",
"alleeId": 258685,
"value": "kursy, ćwiczenia",
"dependsOnValueIds": []
},
{
"id": "250077_1797506",
"alleeId": 258686,
"value": "musicale",
"dependsOnValueIds": []
},
{
"id": "250077_1797507",
"alleeId": 258687,
"value": "opery",
"dependsOnValueIds": []
},
{
"id": "250077_1797508",
"alleeId": 258688,
"value": "popularnonaukowe",
"dependsOnValueIds": []
},
{
"id": "250077_1797510",
"alleeId": 258689,
"value": "przygodowe",
"dependsOnValueIds": []
},
{
"id": "250077_1797511",
"alleeId": 258690,
"value": "romanse",
"dependsOnValueIds": []
},
{
"id": "250077_1797512",
"alleeId": 258691,
"value": "science fiction",
"dependsOnValueIds": []
},
{
"id": "250077_1797513",
"alleeId": 258692,
"value": "sensacyjne",
"dependsOnValueIds": []
},
{
"id": "250077_1797514",
"alleeId": 258693,
"value": "seriale",
"dependsOnValueIds": []
},
{
"id": "250077_1797515",
"alleeId": 258694,
"value": "spektakle teatralne",
"dependsOnValueIds": []
},
{
"id": "250077_1797516",
"alleeId": 258695,
"value": "thrillery",
"dependsOnValueIds": []
},
{
"id": "250077_1797
… (skrócono — pełna odpowiedź ma 40 KB)Podpowiedź kategorii dla nazwy
GET /sale/matching-categories
Allegro + rozszerzenialimit: read
Najlepiej pasujące kategorie-liście dla nazwy produktu (z bazy słów kategorii allee, bez modeli AI na żywo). Najlepsza pierwsza; allee.score = trafność.
Zgodność: zgodna z Allegro REST API, z rozszerzeniami allee (pola allee.*, alleeId) — GET /sale/matching-categories.
Uprawnienie: dowolny ważny token lub klucz (działa też token aplikacji client_credentials).
Grupa limitu: read.
Parametry zapytania
name string wymaganyNazwa produktu albo tytuł oferty, np. „film dvd” (2–200 znaków).
Odpowiedzi
200 Podpowiedzi. · MatchingCategoryList
matchingCategories array<object> zawszePola obiektu
id string · null zawszealleeId integer zawszename string zawszeleaf boolean zawszeparent MatchingCategoryParent · null zawszePola obiektu
id string · null zawszealleeId integer zawszename string zawszeleaf boolean zawszeparent MatchingCategoryParent · null zawszeallee object zawszePola obiektu
score number zawszeTrafność dopasowania (większa = lepsza).
Błędy
| HTTP | Kod | Znaczenie |
|---|---|---|
| 400 | VALIDATION_ERROR | Zła wartość parametru zapytania (400) albo pola treści (422); path wskazuje miejsce. |
| 401 | invalid_token | Brak, zły, wygasły albo odwołany token lub klucz (format OAuth, nagłówek WWW-Authenticate). |
| 403 | ACCOUNT_INACTIVE | Konto sprzedawcy jest nieaktywne. |
| 403 | AccessDenied | Brak zakresu albo zasób innego sprzedawcy. |
| 403 | KEY_QUARANTINED | Kwarantanna: działa tylko odczyt (wykryto nietypowe użycie). |
| 403 | KEY_SUSPENDED | Klucz albo dostęp aplikacji wstrzymany (przez sprzedawcę albo ochronę). |
| 429 | TOO_MANY_REQUESTS | Przekroczony limit (minutowy, grupy operacji albo IP). |
| 500 | INTERNAL_ERROR | Błąd serwera allee. |
curl -sS -X GET "${ALLEE_API_URL:-https://api.allee.pl}/sale/matching-categories?name=film%20dvd" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-w '\nHTTP %{http_code}\n'<?php
// allee API: GET /sale/matching-categories (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$ch = curl_init($base . '/sale/matching-categories?name=film%20dvd');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
],
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: GET /sale/matching-categories (Python 3, biblioteka requests)
import os
import requests
BASE = os.environ.get("ALLEE_API_URL", "https://api.allee.pl")
headers = {
"Authorization": "Bearer " + os.environ["ALLEE_API_KEY"],
"Accept": "application/vnd.allegro.public.v1+json",
}
r = requests.request("GET", BASE + "/sale/matching-categories?name=film%20dvd", headers=headers, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: GET /sale/matching-categories (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const res = await fetch(`${BASE}/sale/matching-categories?name=film%20dvd`, {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
},
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: GET /sale/matching-categories (C#, .NET 8+, HttpClient)
using System.Net.Http.Headers;
using System.Text;
var baseUrl = Environment.GetEnvironmentVariable("ALLEE_API_URL") ?? "https://api.allee.pl";
using var http = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false });
using var req = new HttpRequestMessage(new HttpMethod("GET"), baseUrl + "/sale/matching-categories?name=film%20dvd");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
using var res = await http.SendAsync(req);
Console.WriteLine($"HTTP {(int)res.StatusCode}");
Console.WriteLine(await res.Content.ReadAsStringAsync());// allee API: GET /sale/matching-categories (Java 11+, java.net.http; uruchom: java Main.java)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String base = System.getenv().getOrDefault("ALLEE_API_URL", "https://api.allee.pl");
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/matching-categories?name=film%20dvd"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpClient http = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
HttpResponse<String> res = http.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println("HTTP " + res.statusCode());
System.out.println(res.body());
}
}// allee API: GET /sale/matching-categories (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
req, err := http.NewRequest("GET", base+"/sale/matching-categories?name=film%20dvd", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ALLEE_API_KEY"))
req.Header.Set("Accept", "application/vnd.allegro.public.v1+json")
klient := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
res, err := klient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
dane, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println("HTTP", res.StatusCode)
fmt.Println(string(dane))
}application/vnd.allegro.public.v1+json{
"matchingCategories": [
{
"id": "748",
"alleeId": 353,
"name": "Film, telewizja",
"leaf": true,
"parent": {
"id": "118",
"alleeId": 25,
"name": "Czasopisma",
"leaf": false,
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6,
"name": "Kultura i rozrywka",
"leaf": false,
"parent": null
}
},
"allee": {
"score": 13
}
},
{
"id": "20585",
"alleeId": 35,
"name": "Filmy",
"leaf": true,
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6,
"name": "Kultura i rozrywka",
"leaf": false,
"parent": null
},
"allee": {
"score": 12
}
},
{
"id": "306309",
"alleeId": 10741,
"name": "Rękawy foliowe",
"leaf": true,
"parent": {
"id": "64537",
"alleeId": 2309,
"name": "Folia",
"leaf": false,
"parent": {
"id": "64482",
"alleeId": 770,
"name": "Pakowanie i wysyłka",
"leaf": false,
"parent": {
"id": "64477",
"alleeId": 21,
"name": "Biuro i Reklama",
"leaf": false,
"parent": {
"id": "4bd97d96-f0ff-46cb-a52c-2992bd972bb1",
"alleeId": 4,
"name": "Firma i usługi",
"leaf": false,
"parent": null
}
}
}
},
"allee": {
"score": 6
}
},
{
"id": "64548",
"alleeId": 11290,
"name": "Stretch",
"leaf": true,
"parent": {
"id": "64537",
"alleeId": 2309,
"name": "Folia",
"leaf": false,
"parent": {
"id": "64482",
"alleeId": 770,
"name": "Pakowanie i wysyłka",
"leaf": false,
"parent": {
"id": "64477",
"alleeId": 21,
"name": "Biuro i Reklama",
"leaf": false,
"parent": {
"id": "4bd97d96-f0ff-46cb-a52c-2992bd972bb1",
"alleeId": 4,
"name": "Firma i usługi",
"leaf": false,
"parent": null
}
}
}
},
"allee": {
"score": 6
}
},
{
"id": "324422",
"alleeId": 6341,
"name": "Wydania pudełkowe",
"leaf": true,
"parent": {
"id": "324420",
"alleeId": 395,
"name": "Gry komputerowe PC",
"leaf": false,
"parent": {
"id": "9",
"alleeId": 39,
"name": "Gry",
"leaf": false,
"parent": {
"id": "38d588fd-7e9c-4c42-a4ae-6831775eca45",
"alleeId": 6,
"name": "Kultura i rozrywka",
"leaf": false,
"parent": null
}
}
},
"allee": {
"score": 6
}
},
{
"id": "259428",
"alleeId": 3682,
"name": "Nagrywarki DVD/HDD",
"leaf": true,
"parent": {
"id": "717",
"alleeId": 1169,
"name": "TV i Video",
"leaf": false,
"parent": {
"id": "10",
"alleeId": 86,
"name": "RTV i AGD",
"leaf": false,
"parent": {
"id": "42540aec-367a-4e5e-b411-17c09b08e41f",
"alleeId": 3,
"name": "Elektronika",
"leaf": false,
"parent": null
}
}
},
"allee": {
"score": 3
}
},
{
"id": "259446",
"alleeId": 3957,
"name": "Odtwarzacze DVD",
"leaf": true,
"parent": {
"id": "717",
"alleeId": 1169,
"name": "TV i Video",
"leaf": false,
"parent": {
"id": "10",
"alleeId": 86,
"name": "RTV i AGD",
"leaf": false,
"parent": {
"id": "42540aec-367a-4e5e-b411-17c09b08e41f",
"alleeId": 3,
"name": "Elektronika",
"leaf": false,
"parent": null
}
}
},
"allee": {
"score": 3
}
},
{
"id": "259432",
"alleeId": 3958,
"name": "Odtwarzacze DVD przenośne",
"leaf": true,
"parent": {
"id": "717",
"alleeId": 1169,
"name": "TV i Video",
"leaf": false,
"parent": {
"id": "10",
"alleeId": 86,
"name": "RTV i AGD",
"leaf": false,
"parent": {
"id": "42540aec-367a-4e5e-b411-17c09b08e41f",
"alleeId": 3,
"name": "Elektronika",
"leaf": false,
"parent": null
}
}
},
"allee": {
"score": 3
}
},
{
"id": "101353",
"alleeId": 9453,
"name": "Nadruki na CD/DVD",
"leaf": true,
"parent": {
"id": "64602",
"alleeId": 1463,
"name": "Akcydensy (poligrafia)",
"leaf": false,
"parent": {
"id": "64485",
"alleeId": 983,
"name": "Reklama",
"leaf": false,
"parent": {
"id": "64477",
"alleeId": 21,
"name": "Biuro i Reklama",
"leaf": false,
"parent": {
"id": "4bd97d96-f0ff-46cb-a52c-2992bd972bb1",
"alleeId": 4,
"name": "Firma i usługi",
"leaf": false,
"parent": null
}
}
}
},
"allee": {
"score": 3
}
},
{
"id": "257289",
"alleeId": 7815,
"name": "DVD",
"leaf": true,
"parent": {
"id": "257286",
"alleeId": 3823,
"name": "Nośniki",
"leaf": false,
"parent": {
"
… (skrócono — pełna odpowiedź ma 6 KB)Zmiany w drzewie kategorii
GET /sale/category-events
zgodna z Allegrolimit: read
Utworzenie, zmiana nazwy, przeniesienie i usunięcie kategorii. Odpytuj z kursorem from = id ostatniego zdarzenia.
Zgodność: zgodna z Allegro REST API (ten sam kształt) — GET /sale/category-events.
Uprawnienie: dowolny ważny token lub klucz (działa też token aplikacji client_credentials).
Grupa limitu: read.
Parametry zapytania
from stringZdarzenia po tym identyfikatorze.
limit integer1–1000.
type array<string>Filtr typów (można powtórzyć albo rozdzielić przecinkiem).
Odpowiedzi
200 Zdarzenia. · CategoryEventList
categoryEvents array<object> zawszePola obiektu
id string zawszeKursor zdarzenia (do parametru from).
type string zawszeCATEGORY_CREATED, CATEGORY_RENAMED, CATEGORY_MOVED, CATEGORY_DELETEDoccurredAt string · date-time zawszecategory object zawszePola obiektu
id string · null zawszealleeId integer zawszename stringparent object · nullPola obiektu
id string · null zawszealleeId integer zawszeredirectCategory object · nullKategoria zastępcza (przy usunięciu).
Pola obiektu
id string · null zawszealleeId integer zawszeBłędy
| HTTP | Kod | Znaczenie |
|---|---|---|
| 400 | VALIDATION_ERROR | Zła wartość parametru zapytania (400) albo pola treści (422); path wskazuje miejsce. |
| 401 | invalid_token | Brak, zły, wygasły albo odwołany token lub klucz (format OAuth, nagłówek WWW-Authenticate). |
| 403 | ACCOUNT_INACTIVE | Konto sprzedawcy jest nieaktywne. |
| 403 | AccessDenied | Brak zakresu albo zasób innego sprzedawcy. |
| 403 | KEY_QUARANTINED | Kwarantanna: działa tylko odczyt (wykryto nietypowe użycie). |
| 403 | KEY_SUSPENDED | Klucz albo dostęp aplikacji wstrzymany (przez sprzedawcę albo ochronę). |
| 429 | TOO_MANY_REQUESTS | Przekroczony limit (minutowy, grupy operacji albo IP). |
| 500 | INTERNAL_ERROR | Błąd serwera allee. |
curl -sS -X GET "${ALLEE_API_URL:-https://api.allee.pl}/sale/category-events?limit=10" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-w '\nHTTP %{http_code}\n'<?php
// allee API: GET /sale/category-events (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$ch = curl_init($base . '/sale/category-events?limit=10');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
],
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: GET /sale/category-events (Python 3, biblioteka requests)
import os
import requests
BASE = os.environ.get("ALLEE_API_URL", "https://api.allee.pl")
headers = {
"Authorization": "Bearer " + os.environ["ALLEE_API_KEY"],
"Accept": "application/vnd.allegro.public.v1+json",
}
r = requests.request("GET", BASE + "/sale/category-events?limit=10", headers=headers, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: GET /sale/category-events (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const res = await fetch(`${BASE}/sale/category-events?limit=10`, {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
},
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: GET /sale/category-events (C#, .NET 8+, HttpClient)
using System.Net.Http.Headers;
using System.Text;
var baseUrl = Environment.GetEnvironmentVariable("ALLEE_API_URL") ?? "https://api.allee.pl";
using var http = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false });
using var req = new HttpRequestMessage(new HttpMethod("GET"), baseUrl + "/sale/category-events?limit=10");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
using var res = await http.SendAsync(req);
Console.WriteLine($"HTTP {(int)res.StatusCode}");
Console.WriteLine(await res.Content.ReadAsStringAsync());// allee API: GET /sale/category-events (Java 11+, java.net.http; uruchom: java Main.java)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String base = System.getenv().getOrDefault("ALLEE_API_URL", "https://api.allee.pl");
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/category-events?limit=10"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpClient http = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
HttpResponse<String> res = http.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println("HTTP " + res.statusCode());
System.out.println(res.body());
}
}// allee API: GET /sale/category-events (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
req, err := http.NewRequest("GET", base+"/sale/category-events?limit=10", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ALLEE_API_KEY"))
req.Header.Set("Accept", "application/vnd.allegro.public.v1+json")
klient := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
res, err := klient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
dane, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println("HTTP", res.StatusCode)
fmt.Println(string(dane))
}application/vnd.allegro.public.v1+json{
"categoryEvents": []
}