Easily integrate 2542 products into your own site!
# Fetch products & stock curl "https://playsultan.com/api/v1/products?currency=EUR&lang=en&in_stock=1&per_page=50" \ -H "Authorization: Bearer pb_live_xxxxxxxxxxxxxxxx" # List on your site with live prices # { "ok": true, "data": [ { "id": 445, "name": "PlayStation $1 USD PSN United States", # "price": 0.82, "currency": "EUR", "price_try": 44.25, "stock": 42, "in_stock": true } ], # "meta": { "page": 1, "total": 2104, "has_more": true } }
<?php // Sync catalog $key = 'pb_live_xxxxxxxxxxxxxxxx'; $page = 1; do { $url = 'https://playsultan.com/api/v1/products?currency=EUR&per_page=200&page=' . $page; $res = file_get_contents($url, false, stream_context_create([ 'http' => ['header' => "Authorization: Bearer $key\r\n"], ])); $body = json_decode($res, true); foreach ($body['data'] as $product) { // write to your own database } $page++; } while (!empty($body['meta']['has_more']));
// Sync catalog const key = 'pb_live_xxxxxxxxxxxxxxxx'; let page = 1, hasMore = true; while (hasMore) { const res = await fetch( `https://playsultan.com/api/v1/products?currency=EUR&per_page=200&page=${page}`, { headers: { Authorization: `Bearer ${key}` } } ); const { data, meta } = await res.json(); for (const product of data) { // write to your own database } hasMore = meta.has_more; page++; }
API access is granted after your application is reviewed.
You must log in to apply.
Log In / Sign Up