Rynki
GET /marketplaces
zgodna z Allegrolimit: read
Jedyny rynek: allee-pl (PLN, pl-PL).
Zgodność: zgodna z Allegro REST API (ten sam kształt) — GET /marketplaces.
Uprawnienie: dowolny ważny token lub klucz (działa też token aplikacji client_credentials).
Grupa limitu: read.
Odpowiedzi
200 Rynki. · MarketplaceList
marketplaces array<object> zawszePola obiektu
id string zawszeWartości:
allee-plname string zawszelanguages object zawszePola obiektu
base string zawszeextra array<string> zawszecurrencies object zawszePola obiektu
base string zawszeextra array<string> zawszeBłędy
| HTTP | Kod | Znaczenie |
|---|---|---|
| 401 | invalid_token | Brak, zły, wygasły albo odwołany token lub klucz (format OAuth, nagłówek WWW-Authenticate). |
| 403 | ACCOUNT_INACTIVE | Konto sprzedawcy jest nieaktywne. |
| 403 | AccessDenied | Brak zakresu albo zasób innego sprzedawcy. |
| 403 | KEY_QUARANTINED | Kwarantanna: działa tylko odczyt (wykryto nietypowe użycie). |
| 403 | KEY_SUSPENDED | Klucz albo dostęp aplikacji wstrzymany (przez sprzedawcę albo ochronę). |
| 429 | TOO_MANY_REQUESTS | Przekroczony limit (minutowy, grupy operacji albo IP). |
| 500 | INTERNAL_ERROR | Błąd serwera allee. |
Przykład
curl -sS -X GET "${ALLEE_API_URL:-https://api.allee.pl}/marketplaces" \
-H "Authorization: Bearer $ALLEE_API_KEY" \
-H "Accept: application/vnd.allegro.public.v1+json" \
-w '\nHTTP %{http_code}\n'<?php
// allee API: GET /marketplaces (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$ch = curl_init($base . '/marketplaces');
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 /marketplaces (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 + "/marketplaces", headers=headers, timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: GET /marketplaces (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const res = await fetch(`${BASE}/marketplaces`, {
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 /marketplaces (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 + "/marketplaces");
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 /marketplaces (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 + "/marketplaces"))
.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 /marketplaces (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+"/marketplaces", 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))
}Odpowiedź (środowisko testowe)
HTTP 200
application/vnd.allegro.public.v1+json{
"marketplaces": [
{
"id": "allee-pl",
"name": "allee.pl",
"languages": {
"base": "pl-PL",
"extra": []
},
"currencies": {
"base": "PLN",
"extra": []
}
}
]
}