Hızlı Başlangıç
Bu rehber, iş ortağının FriSay Web API ile uçtan uca entegrasyonunu adım adım özetler: API anahtarı, katalog, ürün, sipariş, kargo ve fatura.
Test sitesi:
https://fyazilim.com/fshop/admin —
kullanıcı admin@fyazilim.com / admin123.
API anahtarını Yönetim → API bölümünden alın.
Ayrıntılar için Giriş sayfasına bakın.
Adım adım
- Yönetim panelinde Web API özelliğini etkinleştirin ve uygun kapsamlarla (ürün / sipariş okuma-yazma vb.) bir anahtar oluşturun. Bkz. Kimlik Doğrulama.
- Kategori ve marka listelerini çekin; ürün oluştururken ID veya ad kullanabilirsiniz. Bkz. Kategorileri Listele, Markaları Listele.
- Ürün oluşturun (ad, kategori, marka, fiyat zorunlu), ardından görsel yükleyin. Bkz. Ürün Ekle, Görsel Yükle, Ürünleri Listele.
-
Siparişleri periyodik olarak sorgulayın (
page0 tabanlıdır); durum ve tarih filtrelerini kullanın. Bkz. Siparişleri Listele. - Kargoya verirken durumu güncelleyin ve kargo firması + takip numarası gönderin. Bkz. Sipariş Durumunu Güncelle.
- Sevkiyattan sonra herkese açık fatura URL'sini siparişe ekleyin. Bkz. Sipariş Faturası.
Önerilen akış
| Sıra | İşlem | Endpoint / sayfa |
|---|---|---|
| 1 | API anahtarı + kapsamlar | authentication |
| 2 | Kategori / marka keşfi | GET /categories, GET /brands |
| 3 | Ürün oluştur + görsel | add-product → POST /products/{id}/image |
| 4 | Siparişleri tara (poll) | list-orders (page=0) |
| 5 | Durum + kargo takibi | update-order-status |
| 6 | Fatura URL'si | order-invoice |
Önemli: Sipariş, kategori ve marka listelerinde sayfa numarası
0 tabanlıdır; ürün listesinde ise 1 tabanlıdır.
Ayrıntılar için API Kuralları sayfasına bakın.
İlgili sayfalar
PHP
<?php
$baseUrl = 'https://example.com/api/v1';
$apiKey = 'YOUR_API_KEY';
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 => true,
]);
if ($data !== null) {
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
}
$response = curl_exec($ch);
$httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
$decoded = json_decode((string) $response, true);
return [
'http_code' => $httpCode,
'curl_error' => $error,
'response' => is_array($decoded) ? $decoded : $response,
];
}
// 1) List categories (0-based page)
$categories = apiRequest('GET', $baseUrl . '/categories?page=0&size=50&active=1', $apiKey);
// 2) Create a simple product
$created = apiRequest('POST', $baseUrl . '/products', $apiKey, [
'name' => 'API Demo Product',
'category' => 'Test Category',
'brand' => 'Test Brand',
'price' => 149.90,
'stock' => 20,
'active' => 1,
'stock_code' => 'DEMO-001',
]);
$productId = (int) ($created['response']['data']['id'] ?? 0);
// 3) List recent picking orders (0-based page)
$orders = apiRequest(
'GET',
$baseUrl . '/orders?page=0&size=20&status=2&date_from=2026-06-01',
$apiKey
);
print_r([
'categories_http' => $categories['http_code'],
'product_id' => $productId,
'orders_http' => $orders['http_code'],
]);
cURL
# 1) Smoke test — categories
curl -s -H "X-API-Key: YOUR_API_KEY" -H "Accept: application/json" \
"https://example.com/api/v1/categories?page=0&size=20"
# 2) Create product
curl -s -X POST \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "API Demo Product",
"category": "Test Category",
"brand": "Test Brand",
"price": 149.90,
"stock": 20,
"active": 1,
"stock_code": "DEMO-001"
}' \
"https://example.com/api/v1/products"
# 3) List picking orders (page is 0-based)
curl -s -H "X-API-Key: YOUR_API_KEY" -H "Accept: application/json" \
"https://example.com/api/v1/orders?page=0&size=20&status=2&date_from=2026-06-01"
# 4) Mark shipped + cargo (replace 15 with order id)
curl -s -X PATCH \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"status":3,"cargoCompany":"Yurtiçi Kargo","trackingNumber":"YT123456789"}' \
"https://example.com/api/v1/orders/15"
# 5) Attach invoice URL
curl -s -X POST \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/fatura.pdf","name":"Invoice"}' \
"https://example.com/api/v1/orders/15/invoice"