Pierwsza oferta w 10 minut
Przejdziesz całą ścieżkę sprzedaży przez API na koncie demo w sandboxie — bez ryzyka dla prawdziwych ofert i kupujących. Całą ścieżkę uruchomiliśmy od zera na środowisku testowym we wszystkich 7 językach.
Identyfikatory w przykładach. Każdy sprzedawca dostaje własne identyfikatory (UUID, numer oferty), więc w kodzie stoją napisy WSTAW_ID_…. Zanim uruchomisz przykład, zastąp je wartością z odpowiedzi wskazanego kroku:
| Napis w kodzie | Skąd wziąć |
|---|---|
WSTAW_ID_CENNIKA | pole id z kroku 3 (albo shippingRates.id z kroku 1) |
WSTAW_ID_WARUNKOW_ZWROTOW | pole id z kroku 4 (albo returnPolicy.id z kroku 1) |
WSTAW_ID_REKOJMI | pole impliedWarranty.id z kroku 1 (konto demo ma gotowe warunki reklamacji) |
WSTAW_ID_PRODUCENTA | pole id z kroku 4 (albo responsibleProducer.id z kroku 1) |
WSTAW_ID_OFERTY | pole id z odpowiedzi na wystawienie oferty (krok 5) |
WSTAW_ID_ZAMOWIENIA, WSTAW_ID_POZYCJI | pola id i lineItems[0].id z odpowiedzi na zamówienie testowe (krok 7) |
1. Klucz testowy
W panelu sprzedaży: Klucze API → Nowy klucz, uprawnienia Pełny dostęp, włączony przełącznik Tryb test (sandbox). Klucz allee_sk_test_… zobaczysz tylko raz — zapisz go w menedżerze sekretów i ustaw zmienne środowiska:
export ALLEE_API_URL="https://api.allee.pl"
export ALLEE_API_KEY="allee_sk_test_…" # klucz z panelu — nigdy w kodzie ani w repozytoriumSprawdź połączenie i odbierz identyfikatory konta demo (20 ofert, cennik, warunki, GPSR):
curl -sS -X GET "${ALLEE_API_URL:-https://api.allee.pl}/allee/sandbox" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-w '\nHTTP %{http_code}\n'<?php
// allee API: GET /allee/sandbox (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$ch = curl_init($base . '/allee/sandbox');
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 /allee/sandbox (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 + "/allee/sandbox", headers=headers, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: GET /allee/sandbox (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const res = await fetch(`${BASE}/allee/sandbox`, {
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 /allee/sandbox (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 + "/allee/sandbox");
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 /allee/sandbox (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 + "/allee/sandbox"))
.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 /allee/sandbox (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+"/allee/sandbox", 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))
}2. Kategoria i jej parametry
Nie znasz kategorii? Zapytaj o podpowiedź po nazwie produktu, a potem pobierz parametry kategorii-liścia (wymagane, słowniki, ograniczenia):
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))
}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))
}Wolisz walidować u siebie? GET /allee/categories/{alleeCategoryId}/schema zwraca JSON Schema 2020-12 kompletu atrybutów kategorii — ten sam, którym API sprawdza ofertę.
3. Cennik dostawy
Metody dostawy to słownik allee (GET /sale/delivery-methods). Cennik o tej samej nazwie utworzysz bezpiecznie wiele razy — drugi raz dostaniesz istniejący (200).
curl -sS -X POST "${ALLEE_API_URL:-https://api.allee.pl}/sale/shipping-rates" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"name": "Paczkomat i kurier pobraniowy",
"type": "PHYSICAL",
"rates": [
{
"deliveryMethod": {
"id": "bd0e0bcb-10d1-4584-bf5b-ebd07a86e70f"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "13.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "0.00",
"currency": "PLN"
}
},
{
"deliveryMethod": {
"id": "5c76d200-c6db-46a7-9b78-7d067e8cfb2d"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "17.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "2.00",
"currency": "PLN"
}
}
]
}
JSON<?php
// allee API: POST /sale/shipping-rates (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'name' => 'Paczkomat i kurier pobraniowy',
'type' => 'PHYSICAL',
'rates' => [
[
'deliveryMethod' => [
'id' => 'bd0e0bcb-10d1-4584-bf5b-ebd07a86e70f',
],
'maxQuantityPerPackage' => 5,
'firstItemRate' => [
'amount' => '13.99',
'currency' => 'PLN',
],
'nextItemRate' => [
'amount' => '0.00',
'currency' => 'PLN',
],
],
[
'deliveryMethod' => [
'id' => '5c76d200-c6db-46a7-9b78-7d067e8cfb2d',
],
'maxQuantityPerPackage' => 5,
'firstItemRate' => [
'amount' => '17.99',
'currency' => 'PLN',
],
'nextItemRate' => [
'amount' => '2.00',
'currency' => 'PLN',
],
],
],
];
$ch = curl_init($base . '/sale/shipping-rates');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: POST /sale/shipping-rates (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",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"name": "Paczkomat i kurier pobraniowy",
"type": "PHYSICAL",
"rates": [
{
"deliveryMethod": {
"id": "bd0e0bcb-10d1-4584-bf5b-ebd07a86e70f",
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "13.99",
"currency": "PLN",
},
"nextItemRate": {
"amount": "0.00",
"currency": "PLN",
},
},
{
"deliveryMethod": {
"id": "5c76d200-c6db-46a7-9b78-7d067e8cfb2d",
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "17.99",
"currency": "PLN",
},
"nextItemRate": {
"amount": "2.00",
"currency": "PLN",
},
},
],
}
r = requests.request("POST", BASE + "/sale/shipping-rates", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: POST /sale/shipping-rates (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"name": "Paczkomat i kurier pobraniowy",
"type": "PHYSICAL",
"rates": [
{
"deliveryMethod": {
"id": "bd0e0bcb-10d1-4584-bf5b-ebd07a86e70f"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "13.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "0.00",
"currency": "PLN"
}
},
{
"deliveryMethod": {
"id": "5c76d200-c6db-46a7-9b78-7d067e8cfb2d"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "17.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "2.00",
"currency": "PLN"
}
}
]
};
const res = await fetch(`${BASE}/sale/shipping-rates`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: POST /sale/shipping-rates (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("POST"), baseUrl + "/sale/shipping-rates");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
var json = """
{
"name": "Paczkomat i kurier pobraniowy",
"type": "PHYSICAL",
"rates": [
{
"deliveryMethod": {
"id": "bd0e0bcb-10d1-4584-bf5b-ebd07a86e70f"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "13.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "0.00",
"currency": "PLN"
}
},
{
"deliveryMethod": {
"id": "5c76d200-c6db-46a7-9b78-7d067e8cfb2d"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "17.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "2.00",
"currency": "PLN"
}
}
]
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: POST /sale/shipping-rates (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");
String body = """
{
"name": "Paczkomat i kurier pobraniowy",
"type": "PHYSICAL",
"rates": [
{
"deliveryMethod": {
"id": "bd0e0bcb-10d1-4584-bf5b-ebd07a86e70f"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "13.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "0.00",
"currency": "PLN"
}
},
{
"deliveryMethod": {
"id": "5c76d200-c6db-46a7-9b78-7d067e8cfb2d"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "17.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "2.00",
"currency": "PLN"
}
}
]
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/shipping-rates"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.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: POST /sale/shipping-rates (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"name": "Paczkomat i kurier pobraniowy",
"type": "PHYSICAL",
"rates": [
{
"deliveryMethod": {
"id": "bd0e0bcb-10d1-4584-bf5b-ebd07a86e70f"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "13.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "0.00",
"currency": "PLN"
}
},
{
"deliveryMethod": {
"id": "5c76d200-c6db-46a7-9b78-7d067e8cfb2d"
},
"maxQuantityPerPackage": 5,
"firstItemRate": {
"amount": "17.99",
"currency": "PLN"
},
"nextItemRate": {
"amount": "2.00",
"currency": "PLN"
}
}
]
}`
req, err := http.NewRequest("POST", base+"/sale/shipping-rates", strings.NewReader(body))
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")
req.Header.Set("Content-Type", "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))
}4. Warunki i GPSR
Warunki zwrotów, reklamacji i gwarancji są opcjonalne. Producent odpowiedzialny i informacja o bezpieczeństwie (GPSR) są wymagane do publikacji oferty wystawionej przez API.
curl -sS -X POST "${ALLEE_API_URL:-https://api.allee.pl}/after-sales-service-conditions/return-policies" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"name": "Zwroty 30 dni",
"availability": {
"range": "FULL"
},
"withdrawalPeriod": "P30D",
"returnCost": {
"coveredBy": "SELLER"
},
"address": {
"name": "Sklep Przykładowy",
"street": "Magazynowa 1",
"postCode": "00-001",
"city": "Warszawa",
"countryCode": "PL"
}
}
JSON<?php
// allee API: POST /after-sales-service-conditions/return-policies (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'name' => 'Zwroty 30 dni',
'availability' => [
'range' => 'FULL',
],
'withdrawalPeriod' => 'P30D',
'returnCost' => [
'coveredBy' => 'SELLER',
],
'address' => [
'name' => 'Sklep Przykładowy',
'street' => 'Magazynowa 1',
'postCode' => '00-001',
'city' => 'Warszawa',
'countryCode' => 'PL',
],
];
$ch = curl_init($base . '/after-sales-service-conditions/return-policies');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: POST /after-sales-service-conditions/return-policies (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",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"name": "Zwroty 30 dni",
"availability": {
"range": "FULL",
},
"withdrawalPeriod": "P30D",
"returnCost": {
"coveredBy": "SELLER",
},
"address": {
"name": "Sklep Przykładowy",
"street": "Magazynowa 1",
"postCode": "00-001",
"city": "Warszawa",
"countryCode": "PL",
},
}
r = requests.request("POST", BASE + "/after-sales-service-conditions/return-policies", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: POST /after-sales-service-conditions/return-policies (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"name": "Zwroty 30 dni",
"availability": {
"range": "FULL"
},
"withdrawalPeriod": "P30D",
"returnCost": {
"coveredBy": "SELLER"
},
"address": {
"name": "Sklep Przykładowy",
"street": "Magazynowa 1",
"postCode": "00-001",
"city": "Warszawa",
"countryCode": "PL"
}
};
const res = await fetch(`${BASE}/after-sales-service-conditions/return-policies`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: POST /after-sales-service-conditions/return-policies (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("POST"), baseUrl + "/after-sales-service-conditions/return-policies");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
var json = """
{
"name": "Zwroty 30 dni",
"availability": {
"range": "FULL"
},
"withdrawalPeriod": "P30D",
"returnCost": {
"coveredBy": "SELLER"
},
"address": {
"name": "Sklep Przykładowy",
"street": "Magazynowa 1",
"postCode": "00-001",
"city": "Warszawa",
"countryCode": "PL"
}
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: POST /after-sales-service-conditions/return-policies (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");
String body = """
{
"name": "Zwroty 30 dni",
"availability": {
"range": "FULL"
},
"withdrawalPeriod": "P30D",
"returnCost": {
"coveredBy": "SELLER"
},
"address": {
"name": "Sklep Przykładowy",
"street": "Magazynowa 1",
"postCode": "00-001",
"city": "Warszawa",
"countryCode": "PL"
}
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/after-sales-service-conditions/return-policies"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.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: POST /after-sales-service-conditions/return-policies (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"name": "Zwroty 30 dni",
"availability": {
"range": "FULL"
},
"withdrawalPeriod": "P30D",
"returnCost": {
"coveredBy": "SELLER"
},
"address": {
"name": "Sklep Przykładowy",
"street": "Magazynowa 1",
"postCode": "00-001",
"city": "Warszawa",
"countryCode": "PL"
}
}`
req, err := http.NewRequest("POST", base+"/after-sales-service-conditions/return-policies", strings.NewReader(body))
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")
req.Header.Set("Content-Type", "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))
}curl -sS -X POST "${ALLEE_API_URL:-https://api.allee.pl}/sale/responsible-producers" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"name": "Wytwórnia Filmowa",
"producerData": {
"tradeName": "Wytwórnia Filmowa Sp. z o.o.",
"address": {
"countryCode": "PL",
"street": "Filmowa 5",
"postalCode": "00-950",
"city": "Warszawa"
},
"contact": {
"email": "[email protected]",
"phoneNumber": "+48 22 100 00 00"
}
}
}
JSON<?php
// allee API: POST /sale/responsible-producers (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'name' => 'Wytwórnia Filmowa',
'producerData' => [
'tradeName' => 'Wytwórnia Filmowa Sp. z o.o.',
'address' => [
'countryCode' => 'PL',
'street' => 'Filmowa 5',
'postalCode' => '00-950',
'city' => 'Warszawa',
],
'contact' => [
'email' => '[email protected]',
'phoneNumber' => '+48 22 100 00 00',
],
],
];
$ch = curl_init($base . '/sale/responsible-producers');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: POST /sale/responsible-producers (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",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"name": "Wytwórnia Filmowa",
"producerData": {
"tradeName": "Wytwórnia Filmowa Sp. z o.o.",
"address": {
"countryCode": "PL",
"street": "Filmowa 5",
"postalCode": "00-950",
"city": "Warszawa",
},
"contact": {
"email": "[email protected]",
"phoneNumber": "+48 22 100 00 00",
},
},
}
r = requests.request("POST", BASE + "/sale/responsible-producers", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: POST /sale/responsible-producers (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"name": "Wytwórnia Filmowa",
"producerData": {
"tradeName": "Wytwórnia Filmowa Sp. z o.o.",
"address": {
"countryCode": "PL",
"street": "Filmowa 5",
"postalCode": "00-950",
"city": "Warszawa"
},
"contact": {
"email": "[email protected]",
"phoneNumber": "+48 22 100 00 00"
}
}
};
const res = await fetch(`${BASE}/sale/responsible-producers`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: POST /sale/responsible-producers (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("POST"), baseUrl + "/sale/responsible-producers");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
var json = """
{
"name": "Wytwórnia Filmowa",
"producerData": {
"tradeName": "Wytwórnia Filmowa Sp. z o.o.",
"address": {
"countryCode": "PL",
"street": "Filmowa 5",
"postalCode": "00-950",
"city": "Warszawa"
},
"contact": {
"email": "[email protected]",
"phoneNumber": "+48 22 100 00 00"
}
}
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: POST /sale/responsible-producers (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");
String body = """
{
"name": "Wytwórnia Filmowa",
"producerData": {
"tradeName": "Wytwórnia Filmowa Sp. z o.o.",
"address": {
"countryCode": "PL",
"street": "Filmowa 5",
"postalCode": "00-950",
"city": "Warszawa"
},
"contact": {
"email": "[email protected]",
"phoneNumber": "+48 22 100 00 00"
}
}
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/responsible-producers"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.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: POST /sale/responsible-producers (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"name": "Wytwórnia Filmowa",
"producerData": {
"tradeName": "Wytwórnia Filmowa Sp. z o.o.",
"address": {
"countryCode": "PL",
"street": "Filmowa 5",
"postalCode": "00-950",
"city": "Warszawa"
},
"contact": {
"email": "[email protected]",
"phoneNumber": "+48 22 100 00 00"
}
}
}`
req, err := http.NewRequest("POST", base+"/sale/responsible-producers", strings.NewReader(body))
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")
req.Header.Set("Content-Type", "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))
}5. Oferta
Najpierw sprawdź ofertę bez zapisu (?validateOnly=true) — dostaniesz pełną listę problemów naraz (poprawna oferta: 200 status: VALID; błędna: 422 z issues[]). Potem wystaw ją naprawdę (201). Nagłówek Idempotency-Key chroni przed podwójną ofertą, gdy połączenie zerwie się po wysłaniu, a external.id (SKU) musi być unikalne — drugi raz to samo SKU da 409 OfferDuplicate.
5a. Sprawdzenie bez zapisu:
curl -sS -X POST "${ALLEE_API_URL:-https://api.allee.pl}/sale/product-offers?validateOnly=true" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
}
JSON<?php
// allee API: POST /sale/product-offers (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'productSet' => [
[
'product' => [
'name' => 'Podróż na Księżyc DVD wydanie kolekcjonerskie',
'category' => [
'id' => '20585',
],
'parameters' => [
[
'id' => '225693',
'values' => [
'5901234123457',
],
],
[
'id' => '237218',
'values' => [
'Podróż na Księżyc',
],
],
[
'id' => '246845',
'valuesIds' => [
'246845_622165',
],
],
[
'id' => '250077',
'valuesIds' => [
'250077_1797493',
],
],
],
'images' => [
'https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp',
],
],
'responsibleProducer' => [
'type' => 'ID',
'id' => 'WSTAW_ID_PRODUCENTA',
],
'safetyInformation' => [
'type' => 'TEXT',
'description' => 'Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła.',
],
],
],
'parameters' => [
[
'id' => '11323',
'valuesIds' => [
'11323_1',
],
],
],
'sellingMode' => [
'format' => 'BUY_NOW',
'price' => [
'amount' => '49.90',
'currency' => 'PLN',
],
],
'stock' => [
'available' => 10,
'unit' => 'UNIT',
],
'external' => [
'id' => 'FILM-DEMO-1',
],
'description' => [
'sections' => [
[
'items' => [
[
'type' => 'TEXT',
'content' => '<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>',
],
],
],
],
],
'delivery' => [
'handlingTime' => 'PT24H',
'shippingRates' => [
'id' => 'WSTAW_ID_CENNIKA',
],
],
'afterSalesServices' => [
'returnPolicy' => [
'id' => 'WSTAW_ID_WARUNKOW_ZWROTOW',
],
'impliedWarranty' => [
'id' => 'WSTAW_ID_REKOJMI',
],
],
'taxSettings' => [
'rates' => [
[
'rate' => '23.00',
'countryCode' => 'PL',
],
],
],
'payments' => [
'invoice' => 'VAT',
],
'location' => [
'city' => 'Warszawa',
'countryCode' => 'PL',
'postCode' => '00-001',
'province' => 'MAZOWIECKIE',
],
'publication' => [
'status' => 'ACTIVE',
],
];
$ch = curl_init($base . '/sale/product-offers?validateOnly=true');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: POST /sale/product-offers (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",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585",
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457",
],
},
{
"id": "237218",
"values": [
"Podróż na Księżyc",
],
},
{
"id": "246845",
"valuesIds": [
"246845_622165",
],
},
{
"id": "250077",
"valuesIds": [
"250077_1797493",
],
},
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp",
],
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA",
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła.",
},
},
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1",
],
},
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN",
},
},
"stock": {
"available": 10,
"unit": "UNIT",
},
"external": {
"id": "FILM-DEMO-1",
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>",
},
],
},
],
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA",
},
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW",
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI",
},
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL",
},
],
},
"payments": {
"invoice": "VAT",
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE",
},
"publication": {
"status": "ACTIVE",
},
}
r = requests.request("POST", BASE + "/sale/product-offers?validateOnly=true", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: POST /sale/product-offers (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
};
const res = await fetch(`${BASE}/sale/product-offers?validateOnly=true`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: POST /sale/product-offers (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("POST"), baseUrl + "/sale/product-offers?validateOnly=true");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
var json = """
{
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: POST /sale/product-offers (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");
String body = """
{
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/product-offers?validateOnly=true"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.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: POST /sale/product-offers (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
}`
req, err := http.NewRequest("POST", base+"/sale/product-offers?validateOnly=true", strings.NewReader(body))
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")
req.Header.Set("Content-Type", "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))
}5b. Wystawienie:
curl -sS -X POST "${ALLEE_API_URL:-https://api.allee.pl}/sale/product-offers" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Idempotency-Key: oferta-FILM-DEMO-1" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
}
JSON<?php
// allee API: POST /sale/product-offers (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'productSet' => [
[
'product' => [
'name' => 'Podróż na Księżyc DVD wydanie kolekcjonerskie',
'category' => [
'id' => '20585',
],
'parameters' => [
[
'id' => '225693',
'values' => [
'5901234123457',
],
],
[
'id' => '237218',
'values' => [
'Podróż na Księżyc',
],
],
[
'id' => '246845',
'valuesIds' => [
'246845_622165',
],
],
[
'id' => '250077',
'valuesIds' => [
'250077_1797493',
],
],
],
'images' => [
'https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp',
],
],
'responsibleProducer' => [
'type' => 'ID',
'id' => 'WSTAW_ID_PRODUCENTA',
],
'safetyInformation' => [
'type' => 'TEXT',
'description' => 'Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła.',
],
],
],
'parameters' => [
[
'id' => '11323',
'valuesIds' => [
'11323_1',
],
],
],
'sellingMode' => [
'format' => 'BUY_NOW',
'price' => [
'amount' => '49.90',
'currency' => 'PLN',
],
],
'stock' => [
'available' => 10,
'unit' => 'UNIT',
],
'external' => [
'id' => 'FILM-DEMO-1',
],
'description' => [
'sections' => [
[
'items' => [
[
'type' => 'TEXT',
'content' => '<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>',
],
],
],
],
],
'delivery' => [
'handlingTime' => 'PT24H',
'shippingRates' => [
'id' => 'WSTAW_ID_CENNIKA',
],
],
'afterSalesServices' => [
'returnPolicy' => [
'id' => 'WSTAW_ID_WARUNKOW_ZWROTOW',
],
'impliedWarranty' => [
'id' => 'WSTAW_ID_REKOJMI',
],
],
'taxSettings' => [
'rates' => [
[
'rate' => '23.00',
'countryCode' => 'PL',
],
],
],
'payments' => [
'invoice' => 'VAT',
],
'location' => [
'city' => 'Warszawa',
'countryCode' => 'PL',
'postCode' => '00-001',
'province' => 'MAZOWIECKIE',
],
'publication' => [
'status' => 'ACTIVE',
],
];
$ch = curl_init($base . '/sale/product-offers');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Idempotency-Key: oferta-FILM-DEMO-1',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: POST /sale/product-offers (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",
"Idempotency-Key": "oferta-FILM-DEMO-1",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585",
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457",
],
},
{
"id": "237218",
"values": [
"Podróż na Księżyc",
],
},
{
"id": "246845",
"valuesIds": [
"246845_622165",
],
},
{
"id": "250077",
"valuesIds": [
"250077_1797493",
],
},
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp",
],
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA",
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła.",
},
},
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1",
],
},
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN",
},
},
"stock": {
"available": 10,
"unit": "UNIT",
},
"external": {
"id": "FILM-DEMO-1",
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>",
},
],
},
],
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA",
},
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW",
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI",
},
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL",
},
],
},
"payments": {
"invoice": "VAT",
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE",
},
"publication": {
"status": "ACTIVE",
},
}
r = requests.request("POST", BASE + "/sale/product-offers", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: POST /sale/product-offers (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
};
const res = await fetch(`${BASE}/sale/product-offers`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Idempotency-Key": "oferta-FILM-DEMO-1",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: POST /sale/product-offers (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("POST"), baseUrl + "/sale/product-offers");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
req.Headers.Add("Idempotency-Key", "oferta-FILM-DEMO-1");
var json = """
{
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: POST /sale/product-offers (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");
String body = """
{
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/sale/product-offers"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Idempotency-Key", "oferta-FILM-DEMO-1")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.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: POST /sale/product-offers (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"productSet": [
{
"product": {
"name": "Podróż na Księżyc DVD wydanie kolekcjonerskie",
"category": {
"id": "20585"
},
"parameters": [
{
"id": "225693",
"values": [
"5901234123457"
]
},
{
"id": "237218",
"values": [
"Podróż na Księżyc"
]
},
{
"id": "246845",
"valuesIds": [
"246845_622165"
]
},
{
"id": "250077",
"valuesIds": [
"250077_1797493"
]
}
],
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
]
},
"responsibleProducer": {
"type": "ID",
"id": "WSTAW_ID_PRODUCENTA"
},
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu. Przechowywać z dala od źródeł ciepła."
}
}
],
"parameters": [
{
"id": "11323",
"valuesIds": [
"11323_1"
]
}
],
"sellingMode": {
"format": "BUY_NOW",
"price": {
"amount": "49.90",
"currency": "PLN"
}
},
"stock": {
"available": 10,
"unit": "UNIT"
},
"external": {
"id": "FILM-DEMO-1"
},
"description": {
"sections": [
{
"items": [
{
"type": "TEXT",
"content": "<h2>Opis</h2><p>Film na płycie DVD, wydanie kolekcjonerskie, nowy w folii.</p><ul><li>Region 2</li><li>Język: polski</li></ul>"
}
]
}
]
},
"delivery": {
"handlingTime": "PT24H",
"shippingRates": {
"id": "WSTAW_ID_CENNIKA"
}
},
"afterSalesServices": {
"returnPolicy": {
"id": "WSTAW_ID_WARUNKOW_ZWROTOW"
},
"impliedWarranty": {
"id": "WSTAW_ID_REKOJMI"
}
},
"taxSettings": {
"rates": [
{
"rate": "23.00",
"countryCode": "PL"
}
]
},
"payments": {
"invoice": "VAT"
},
"location": {
"city": "Warszawa",
"countryCode": "PL",
"postCode": "00-001",
"province": "MAZOWIECKIE"
},
"publication": {
"status": "ACTIVE"
}
}`
req, err := http.NewRequest("POST", base+"/sale/product-offers", strings.NewReader(body))
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")
req.Header.Set("Idempotency-Key", "oferta-FILM-DEMO-1")
req.Header.Set("Content-Type", "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))
}Wolisz model Amazona — adresowanie ofert po SKU, z podglądem walidacji i listą problemów? Ten sam efekt da PUT /allee/listings/{sku}:
curl -sS -X PUT "${ALLEE_API_URL:-https://api.allee.pl}/allee/listings/FILM-DEMO-3" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"requirements": "LISTING",
"status": "ACTIVE",
"attributes": {
"name": "Metropolis DVD wersja odrestaurowana",
"category": {
"alleeId": 35
},
"parameters": {
"225693": {
"values": [
"5901234123464"
]
},
"237218": {
"values": [
"Metropolis"
]
},
"246845": {
"valuesIds": [
"246845_622165"
]
},
"250077": {
"valuesIds": [
"250077_1797493"
]
},
"11323": {
"valuesIds": [
"11323_1"
]
}
},
"price": {
"amount": "59.90",
"currency": "PLN"
},
"stock": 4,
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
],
"description": "Film na płycie DVD, nowy w folii. Wersja z polskimi napisami.",
"shippingRatesId": "WSTAW_ID_CENNIKA",
"responsibleProducerId": "WSTAW_ID_PRODUCENTA",
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu."
}
}
}
JSON<?php
// allee API: PUT /allee/listings/FILM-DEMO-3 (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'requirements' => 'LISTING',
'status' => 'ACTIVE',
'attributes' => [
'name' => 'Metropolis DVD wersja odrestaurowana',
'category' => [
'alleeId' => 35,
],
'parameters' => [
'225693' => [
'values' => [
'5901234123464',
],
],
'237218' => [
'values' => [
'Metropolis',
],
],
'246845' => [
'valuesIds' => [
'246845_622165',
],
],
'250077' => [
'valuesIds' => [
'250077_1797493',
],
],
'11323' => [
'valuesIds' => [
'11323_1',
],
],
],
'price' => [
'amount' => '59.90',
'currency' => 'PLN',
],
'stock' => 4,
'images' => [
'https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp',
],
'description' => 'Film na płycie DVD, nowy w folii. Wersja z polskimi napisami.',
'shippingRatesId' => 'WSTAW_ID_CENNIKA',
'responsibleProducerId' => 'WSTAW_ID_PRODUCENTA',
'safetyInformation' => [
'type' => 'TEXT',
'description' => 'Produkt bezpieczny w normalnym użytkowaniu.',
],
],
];
$ch = curl_init($base . '/allee/listings/FILM-DEMO-3');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: PUT /allee/listings/FILM-DEMO-3 (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",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"requirements": "LISTING",
"status": "ACTIVE",
"attributes": {
"name": "Metropolis DVD wersja odrestaurowana",
"category": {
"alleeId": 35,
},
"parameters": {
"225693": {
"values": [
"5901234123464",
],
},
"237218": {
"values": [
"Metropolis",
],
},
"246845": {
"valuesIds": [
"246845_622165",
],
},
"250077": {
"valuesIds": [
"250077_1797493",
],
},
"11323": {
"valuesIds": [
"11323_1",
],
},
},
"price": {
"amount": "59.90",
"currency": "PLN",
},
"stock": 4,
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp",
],
"description": "Film na płycie DVD, nowy w folii. Wersja z polskimi napisami.",
"shippingRatesId": "WSTAW_ID_CENNIKA",
"responsibleProducerId": "WSTAW_ID_PRODUCENTA",
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu.",
},
},
}
r = requests.request("PUT", BASE + "/allee/listings/FILM-DEMO-3", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: PUT /allee/listings/FILM-DEMO-3 (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"requirements": "LISTING",
"status": "ACTIVE",
"attributes": {
"name": "Metropolis DVD wersja odrestaurowana",
"category": {
"alleeId": 35
},
"parameters": {
"225693": {
"values": [
"5901234123464"
]
},
"237218": {
"values": [
"Metropolis"
]
},
"246845": {
"valuesIds": [
"246845_622165"
]
},
"250077": {
"valuesIds": [
"250077_1797493"
]
},
"11323": {
"valuesIds": [
"11323_1"
]
}
},
"price": {
"amount": "59.90",
"currency": "PLN"
},
"stock": 4,
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
],
"description": "Film na płycie DVD, nowy w folii. Wersja z polskimi napisami.",
"shippingRatesId": "WSTAW_ID_CENNIKA",
"responsibleProducerId": "WSTAW_ID_PRODUCENTA",
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu."
}
}
};
const res = await fetch(`${BASE}/allee/listings/FILM-DEMO-3`, {
method: "PUT",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: PUT /allee/listings/FILM-DEMO-3 (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("PUT"), baseUrl + "/allee/listings/FILM-DEMO-3");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
var json = """
{
"requirements": "LISTING",
"status": "ACTIVE",
"attributes": {
"name": "Metropolis DVD wersja odrestaurowana",
"category": {
"alleeId": 35
},
"parameters": {
"225693": {
"values": [
"5901234123464"
]
},
"237218": {
"values": [
"Metropolis"
]
},
"246845": {
"valuesIds": [
"246845_622165"
]
},
"250077": {
"valuesIds": [
"250077_1797493"
]
},
"11323": {
"valuesIds": [
"11323_1"
]
}
},
"price": {
"amount": "59.90",
"currency": "PLN"
},
"stock": 4,
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
],
"description": "Film na płycie DVD, nowy w folii. Wersja z polskimi napisami.",
"shippingRatesId": "WSTAW_ID_CENNIKA",
"responsibleProducerId": "WSTAW_ID_PRODUCENTA",
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu."
}
}
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: PUT /allee/listings/FILM-DEMO-3 (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");
String body = """
{
"requirements": "LISTING",
"status": "ACTIVE",
"attributes": {
"name": "Metropolis DVD wersja odrestaurowana",
"category": {
"alleeId": 35
},
"parameters": {
"225693": {
"values": [
"5901234123464"
]
},
"237218": {
"values": [
"Metropolis"
]
},
"246845": {
"valuesIds": [
"246845_622165"
]
},
"250077": {
"valuesIds": [
"250077_1797493"
]
},
"11323": {
"valuesIds": [
"11323_1"
]
}
},
"price": {
"amount": "59.90",
"currency": "PLN"
},
"stock": 4,
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
],
"description": "Film na płycie DVD, nowy w folii. Wersja z polskimi napisami.",
"shippingRatesId": "WSTAW_ID_CENNIKA",
"responsibleProducerId": "WSTAW_ID_PRODUCENTA",
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu."
}
}
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/allee/listings/FILM-DEMO-3"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("PUT", HttpRequest.BodyPublishers.ofString(body))
.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: PUT /allee/listings/FILM-DEMO-3 (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"requirements": "LISTING",
"status": "ACTIVE",
"attributes": {
"name": "Metropolis DVD wersja odrestaurowana",
"category": {
"alleeId": 35
},
"parameters": {
"225693": {
"values": [
"5901234123464"
]
},
"237218": {
"values": [
"Metropolis"
]
},
"246845": {
"valuesIds": [
"246845_622165"
]
},
"250077": {
"valuesIds": [
"250077_1797493"
]
},
"11323": {
"valuesIds": [
"11323_1"
]
}
},
"price": {
"amount": "59.90",
"currency": "PLN"
},
"stock": 4,
"images": [
"https://cdn.allee.pl/img/a/webe/1930/10001318-0-1200.webp"
],
"description": "Film na płycie DVD, nowy w folii. Wersja z polskimi napisami.",
"shippingRatesId": "WSTAW_ID_CENNIKA",
"responsibleProducerId": "WSTAW_ID_PRODUCENTA",
"safetyInformation": {
"type": "TEXT",
"description": "Produkt bezpieczny w normalnym użytkowaniu."
}
}
}`
req, err := http.NewRequest("PUT", base+"/allee/listings/FILM-DEMO-3", strings.NewReader(body))
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")
req.Header.Set("Content-Type", "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))
}6. Czy oferta da się kupić?
curl -sS -X GET "${ALLEE_API_URL:-https://api.allee.pl}/sale/offers/WSTAW_ID_OFERTY/buyability" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-w '\nHTTP %{http_code}\n'<?php
// allee API: GET /sale/offers/WSTAW_ID_OFERTY/buyability (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$ch = curl_init($base . '/sale/offers/WSTAW_ID_OFERTY/buyability');
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/offers/WSTAW_ID_OFERTY/buyability (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/offers/WSTAW_ID_OFERTY/buyability", headers=headers, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: GET /sale/offers/WSTAW_ID_OFERTY/buyability (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const res = await fetch(`${BASE}/sale/offers/WSTAW_ID_OFERTY/buyability`, {
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/offers/WSTAW_ID_OFERTY/buyability (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/offers/WSTAW_ID_OFERTY/buyability");
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/offers/WSTAW_ID_OFERTY/buyability (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/offers/WSTAW_ID_OFERTY/buyability"))
.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/offers/WSTAW_ID_OFERTY/buyability (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/offers/WSTAW_ID_OFERTY/buyability", 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))
}7. Zamówienie testowe
W sandboxie kupującego zastępuje symulator. Zamówienie pojawi się w GET /order/checkout-forms i w zdarzeniach.
curl -sS -X POST "${ALLEE_API_URL:-https://api.allee.pl}/allee/sandbox/orders" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"offerId": "WSTAW_ID_OFERTY",
"quantity": 2,
"paymentType": "ONLINE",
"invoice": true,
"messageToSeller": "Proszę o staranne zapakowanie."
}
JSON<?php
// allee API: POST /allee/sandbox/orders (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'offerId' => 'WSTAW_ID_OFERTY',
'quantity' => 2,
'paymentType' => 'ONLINE',
'invoice' => true,
'messageToSeller' => 'Proszę o staranne zapakowanie.',
];
$ch = curl_init($base . '/allee/sandbox/orders');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: POST /allee/sandbox/orders (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",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"offerId": "WSTAW_ID_OFERTY",
"quantity": 2,
"paymentType": "ONLINE",
"invoice": True,
"messageToSeller": "Proszę o staranne zapakowanie.",
}
r = requests.request("POST", BASE + "/allee/sandbox/orders", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: POST /allee/sandbox/orders (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"offerId": "WSTAW_ID_OFERTY",
"quantity": 2,
"paymentType": "ONLINE",
"invoice": true,
"messageToSeller": "Proszę o staranne zapakowanie."
};
const res = await fetch(`${BASE}/allee/sandbox/orders`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: POST /allee/sandbox/orders (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("POST"), baseUrl + "/allee/sandbox/orders");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
var json = """
{
"offerId": "WSTAW_ID_OFERTY",
"quantity": 2,
"paymentType": "ONLINE",
"invoice": true,
"messageToSeller": "Proszę o staranne zapakowanie."
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: POST /allee/sandbox/orders (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");
String body = """
{
"offerId": "WSTAW_ID_OFERTY",
"quantity": 2,
"paymentType": "ONLINE",
"invoice": true,
"messageToSeller": "Proszę o staranne zapakowanie."
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/allee/sandbox/orders"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.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: POST /allee/sandbox/orders (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"offerId": "WSTAW_ID_OFERTY",
"quantity": 2,
"paymentType": "ONLINE",
"invoice": true,
"messageToSeller": "Proszę o staranne zapakowanie."
}`
req, err := http.NewRequest("POST", base+"/allee/sandbox/orders", strings.NewReader(body))
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")
req.Header.Set("Content-Type", "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))
}Realizacja: status, numer przesyłki, wysłano:
curl -sS -X PUT "${ALLEE_API_URL:-https://api.allee.pl}/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"status": "PROCESSING"
}
JSON<?php
// allee API: PUT /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'status' => 'PROCESSING',
];
$ch = curl_init($base . '/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: PUT /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment (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",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"status": "PROCESSING",
}
r = requests.request("PUT", BASE + "/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: PUT /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"status": "PROCESSING"
};
const res = await fetch(`${BASE}/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment`, {
method: "PUT",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: PUT /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment (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("PUT"), baseUrl + "/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
var json = """
{
"status": "PROCESSING"
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: PUT /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment (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");
String body = """
{
"status": "PROCESSING"
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("PUT", HttpRequest.BodyPublishers.ofString(body))
.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: PUT /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"status": "PROCESSING"
}`
req, err := http.NewRequest("PUT", base+"/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/fulfillment", strings.NewReader(body))
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")
req.Header.Set("Content-Type", "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))
}curl -sS -X POST "${ALLEE_API_URL:-https://api.allee.pl}/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-H "Content-Type: application/vnd.allegro.public.v1+json" \
--data-binary @- \
-w '\nHTTP %{http_code}\n' <<'JSON'
{
"carrierId": "INPOST",
"waybill": "620111222333444555495937",
"lineItems": [
{
"id": "WSTAW_ID_POZYCJI"
}
]
}
JSON<?php
// allee API: POST /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = [
'carrierId' => 'INPOST',
'waybill' => '620111222333444555495937',
'lineItems' => [
[
'id' => 'WSTAW_ID_POZYCJI',
],
],
];
$ch = curl_init($base . '/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ALLEE_API_KEY'),
'Accept: application/vnd.allegro.public.v1+json',
'Content-Type: application/vnd.allegro.public.v1+json',
],
CURLOPT_POSTFIELDS => json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: POST /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments (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",
"Content-Type": "application/vnd.allegro.public.v1+json",
}
body = {
"carrierId": "INPOST",
"waybill": "620111222333444555495937",
"lineItems": [
{
"id": "WSTAW_ID_POZYCJI",
},
],
}
r = requests.request("POST", BASE + "/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments", headers=headers, json=body, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: POST /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = {
"carrierId": "INPOST",
"waybill": "620111222333444555495937",
"lineItems": [
{
"id": "WSTAW_ID_POZYCJI"
}
]
};
const res = await fetch(`${BASE}/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ALLEE_API_KEY}`,
"Accept": "application/vnd.allegro.public.v1+json",
"Content-Type": "application/vnd.allegro.public.v1+json",
},
body: JSON.stringify(body),
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: POST /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments (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("POST"), baseUrl + "/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments");
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ALLEE_API_KEY"));
req.Headers.Accept.ParseAdd("application/vnd.allegro.public.v1+json");
var json = """
{
"carrierId": "INPOST",
"waybill": "620111222333444555495937",
"lineItems": [
{
"id": "WSTAW_ID_POZYCJI"
}
]
}
""";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("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: POST /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments (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");
String body = """
{
"carrierId": "INPOST",
"waybill": "620111222333444555495937",
"lineItems": [
{
"id": "WSTAW_ID_POZYCJI"
}
]
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments"))
.header("Authorization", "Bearer " + System.getenv("ALLEE_API_KEY"))
.header("Accept", "application/vnd.allegro.public.v1+json")
.header("Content-Type", "application/vnd.allegro.public.v1+json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.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: POST /order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `{
"carrierId": "INPOST",
"waybill": "620111222333444555495937",
"lineItems": [
{
"id": "WSTAW_ID_POZYCJI"
}
]
}`
req, err := http.NewRequest("POST", base+"/order/checkout-forms/WSTAW_ID_ZAMOWIENIA/shipments", strings.NewReader(body))
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")
req.Header.Set("Content-Type", "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))
}8. Produkcja
Utwórz klucz w trybie Produkcja (allee_sk_live_…) — ten sam kod, ten sam adres API. Dobre praktyki: lista IP i najmniejsze uprawnienia, powiadomienia push zamiast częstego odpytywania, ponawianie po Retry-After.