List Products
Returns a paginated list of products in your store.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number (default: 1) |
limit | integer | No | Records per page (default: 20, max: 100) |
PHP
<?php
$baseUrl = 'https://example.com/api/v1/';
$apiKey = ''; // You need to obtain a token from the admin for the API Key.
$result = '';
function apiRequest($method, $url, $apiKey, $data = null)
{
$ch = curl_init();
$headers = [
'X-API-Key: ' . trim($apiKey),
'Accept: application/json',
];
if ($data !== null) {
$headers[] = 'Content-Type: application/json';
}
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_SSL_VERIFYPEER => false,
]);
if ($data !== null) {
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
}
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
return [
'http_code' => $httpCode,
'curl_error' => $error,
'response' => json_decode($response, true) ?: $response,
];
}
$result = apiRequest('GET', $baseUrl . '/products?page=1&limit=20', $apiKey);
Sample Response (JSON)
(
[http_code] => 200
[curl_error] =>
[response] => Array
(
[success] => 1
[data] => Array
(
[0] => Array
(
[id] => 5
[name] => Multivitamin Complex 60 Tablet
[slug] => multivitamin-complex-60
[url] => http://localhost/frisay/multivitamin-complex-60-5
[price] => 329
[old_price] => 399
[stock] => 200
[in_stock] => 1
[active] => 1
[barcode] => 8690000000059
[stock_code] => DEMO-MULTI60
[id_category] => 3
[category_name] => Vitamin & Takviye
[id_brand] => 3
[brand_name] => FShop Demo
[image_url] => http://localhost/frisay/templates/default/img/favicon.png
)
[1] => Array
(
[id] => 4
[name] => Akıllı Saat Lite
[slug] => akilli-saat-lite
[url] => http://localhost/frisay/akilli-saat-lite-4
[price] => 4206.83
[old_price] => 0
[stock] => 25
[in_stock] => 1
[active] => 1
[barcode] => 8690000000042
[stock_code] => TECH-WATCH79
[id_category] => 4
[category_name] => Elektronik
[id_brand] => 2
[brand_name] => TechnoMark
[image_url] => http://localhost/frisay/templates/default/img/favicon.png
)
)
[meta] => Array
(
[total] => 2
[page] => 1
[limit] => 20
[pages] => 1
)
)
)