API - dokumentacja
Pobierz plik
Autoryzacja
Każde zapytanie do API musi zawierać ważny klucz API w nagłówku HTTP 'Authorization'.
Stany magazynowe
GET https://pentel.pl/api/inventory
JSON
Accept: application/json
lub GET /api/inventory?format=json
{
"items": [
{
"sku": "300E-2H",
"ean": "3474377352005",
"inventory": 222,
"price": 0.99
},
{
"sku": "300E-3H",
"ean": "3474377352272",
"inventory": 333,
"price": 0.55
}
]
}
XML
Accept: application/xml
lub GET /api/inventory?format=xml
<?xml version="1.0" encoding="UTF-8"?>
<pentel>
<item>
<sku>300E-2H</sku>
<ean>3474377352005</ean>
<inventory>222</inventory>
<price>0.99</price>
</item>
<item>
<sku>300E-3H</sku>
<ean>3474377352272</ean>
<inventory>333</inventory>
<price>0.55</price>
</item>
</pentel>
Przykład
CURL
curl -X GET "https://pentel.pl/api/inventory" -H "accept: application/json" \
-H "Authorization: API-KEY"
PHP
define ('PENTEL_API_KEY','xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'Authorization: '.PENTEL_API_KEY,
]);
curl_setopt($ch, CURLOPT_URL,'https://pentel.pl/api/inventory');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close($ch);
die ($server_output);