Ürün Uçları
Ürün kataloğunu listeleyen, ürün açan, okuyan, güncelleyen ve silen dokuz uç.
Genel Bakış
Bu uçlar katalogdaki ürünün kendisini yönetir: listeleme, oluşturma, okuma, güncelleme ve silme. Yanlarındaki üç arama ucu oluşturma sırasında hangi değerlerin geçerli olduğunu söyler.
Oluşturma ile güncelleme arasında bilinçli bir iş bölümü var: oluşturma yalnız iskeleti kurar, ürünü satılabilir yapan her şey güncelleme ucundan girer. Panel de aynı sırayı izler.
Referans
Ürünleri Listeleme
Ürün kataloğunu döndürür. Süzgeç vermezseniz tüm tipler gelir, en yeniden eskiye.
hosting, server, software, ssl ya da special.type alanını special yapmayı gerektirir.active ya da inactive.none.active ya da inactive.{id, title}. Kategorisiz üründe başlık boş gelir.0 son sayfada olduğunuz anlamına gelir.curl -G 'https://panel.ornek.com/api/v1/admin/products' \
-H "Authorization: Bearer $API_KEY" \
-d type=hosting \
-d limit=50const url = new URL('https://panel.ornek.com/api/v1/admin/products');
url.searchParams.set('type', 'hosting');
url.searchParams.set('limit', '50');
const res = await fetch(url, { headers: { Authorization: `Bearer ${apiKey}` } });
const body = await res.json();$url = 'https://panel.ornek.com/api/v1/admin/products?' . http_build_query(['type' => 'hosting', 'limit' => 50]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$page = 1;
$all = [];
do {
$response = Api::Products()->GetProducts([], [
'type' => 'hosting',
'page' => $page,
'limit' => 100,
]);
$all = array_merge($all, $response['data']);
$page = $response['meta']['next_page'];
} while ($page > 0);{
"data": [
{
"id": 15,
"title": "Starter SSD 1",
"type": "hosting",
"module": "cPanel",
"status": "active",
"category": { "id": 439, "title": "Economy Web Hosting" },
"service_count": 12,
"created_at": "2026-01-01 10:00:00"
}
],
"meta": { "total": 499, "page": 1, "limit": 25, "next_page": 2 }
}Ürün Oluşturma
İskelet bir ürün açar. Fiyat, limit ve dil içeriği sonradan güncelleme ucuyla girilir.
hosting, server, software ya da special. ssl tek başına açılamaz; özel grup içinde yaşar.special ise zorunlu.201 ile döner. Detay ucuyla aynı şekildedir.name boş.special ama grup verilmedi.gate:product.create kancası işlemi veto etti.curl -X POST 'https://panel.ornek.com/api/v1/admin/products' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"type":"hosting","name":"Starter SSD 1","category":439,"module":"cPanel"}'const res = await fetch('https://panel.ornek.com/api/v1/admin/products', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'hosting',
name: 'Starter SSD 1',
category: 439,
module: 'cPanel',
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'type' => 'hosting',
'name' => 'Starter SSD 1',
'category' => 439,
'module' => 'cPanel',
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Olusturma iskelet birakir; kullanilabilir bir urun icin ardindan guncelleyin.
$created = Api::Products()->CreateProduct([
'type' => 'hosting',
'name' => 'Starter SSD 1',
'category' => 439,
'module' => 'cPanel',
]);
Api::Products()->UpdateProduct([
'id' => $created['data']['id'],
'limits' => ['disk' => 100, 'bandwidth' => 'unlimited'],
]);Ürün Detayı
Ürünün tüm ayarlarını, ilişkilerini ve her dildeki içeriğini döndürür.
{id, name}.active ya da inactive.visible ya da invisible.{enabled, items}.null sınırsız demektir.{enabled, days}.{enabled, value}.{enabled, days}.curl 'https://panel.ornek.com/api/v1/admin/products/15' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/products/15', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/15');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Products()->GetProduct(['id' => 15]);
// module_data'nin sekli modulden geliyor — anahtar varligini kontrol edin.
$plan = $response['data']['module_data']['plan'] ?? null;Ürünü Güncelleme
Gönderdiğiniz alanları uygular, geri kalanını olduğu gibi bırakır.
active ya da inactive.{enabled, days}.{enabled, value}.{enabled, days}.popular, auto_approval, auto_install, seo_index, restrict_access, order_limit_per_user, free_domain, domain_requirement, hide_domain, show_domain, hide_hosting, show_hosting, change_domain, renewal_selection_hide, download_link, demo_link, demo_admin_link, demo_admin_link, product_file_access, ctoc_service_transfer, server_group_id, server_id, activation_notification. domain_requirement, hosting, server ve special ürünlerde none, optional ya da required değerini alır ve hide_domain / show_domain bayrağını türetir; yalnız eski bayrağı göndermek de çalışır, bilinmeyen değer yoksayılır.disk, bandwidth, email, database, addons, subdomain, ftp, park, max_email_per_hour. Her biri sayı ya da unlimited. Boş değer, null ya da negatif sayı unlimited olarak kaydedilir; üründen okunan değer olduğu gibi geri gönderilebilir. Sayım sınırlarında 0 hak vermez.limits değeri sayı, unlimited, boş ya da null değil. details.field hangisi olduğunu söyler.curl -X PATCH 'https://panel.ornek.com/api/v1/admin/products/15' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"status":"inactive","limits":{"disk":100,"bandwidth":"unlimited"}}'const res = await fetch('https://panel.ornek.com/api/v1/admin/products/15', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
status: 'inactive',
limits: { disk: 100, bandwidth: 'unlimited' },
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/15');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'status' => 'inactive',
'limits' => ['disk' => 100, 'bandwidth' => 'unlimited'],
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Yalniz Ingilizce metni degistirmek diger dillere dokunmaz.
$response = Api::Products()->UpdateProduct([
'id' => 15,
'langs' => [
'en' => ['title' => 'Starter SSD 1', 'features' => 'NVMe storage'],
],
]);Toplu Durum Değiştirme
Birden çok ürünün durumunu tek çağrıda değiştirir. Silme bu uçtan yapılamaz.
active ya da inactive.ids boş.curl -X POST 'https://panel.ornek.com/api/v1/admin/products/bulk' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"ids":[15,16],"action":"inactive"}'const res = await fetch('https://panel.ornek.com/api/v1/admin/products/bulk', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ ids: [15, 16], action: 'inactive' }),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/bulk');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'ids' => [15, 16],
'action' => 'inactive',
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Products()->BulkProducts([
'ids' => [15, 16],
'action' => 'inactive',
]);Ürünü Silme
Ürünü siler. Dil kayıtları ve fiyatları birlikte gider.
gate:product.delete kancası işlemi veto etti.curl -X DELETE 'https://panel.ornek.com/api/v1/admin/products/2030' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/products/2030', {
method: 'DELETE',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/2030');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Products()->DeleteProduct(['id' => 2030]);Ürün Tiplerini Listeleme
Bu kurulumda kullanılabilen ürün tiplerini döndürür. Oluştururken geçerli değerler buradan gelir.
curl 'https://panel.ornek.com/api/v1/admin/products/types' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/products/types', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/types');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Products()->GetProductTypes();Grupları Listeleme
Sabit ve özel katalog gruplarını döndürür. Her satır oluşturma için hazır bir tip ve grup çifti verir.
curl 'https://panel.ornek.com/api/v1/admin/products/groups' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/products/groups', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/groups');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Grup satiri olusturma govdesinin iki alanini birden verir.
$group = Api::Products()->GetProductGroups()['data'][0];
Api::Products()->CreateProduct([
'type' => $group['type'],
'group_id' => $group['group_id'],
'name' => 'New product',
]);Kategorileri Listeleme
Kategori listesini düz olarak döndürür. Ağacı üst kimliklerden siz kurarsınız.
hosting.special yapar.curl -G 'https://panel.ornek.com/api/v1/admin/products/categories' \
-H "Authorization: Bearer $API_KEY" \
-d type=hostingconst url = new URL('https://panel.ornek.com/api/v1/admin/products/categories');
url.searchParams.set('type', 'hosting');
const res = await fetch(url, { headers: { Authorization: `Bearer ${apiKey}` } });
const body = await res.json();$url = 'https://panel.ornek.com/api/v1/admin/products/categories?' . http_build_query(['type' => 'hosting']);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$rows = Api::Products()->GetProductCategories([], ['type' => 'hosting'])['data'];
$byParent = [];
foreach ($rows as $row) $byParent[$row['parent_id']][] = $row;Tuzaklar
Yeni ürün iskelet hâlde doğar: varsayılan para biriminde sıfır tutarlı aylık bir fiyat konur ve başlık tüm dillere kopyalanır. Limitler, gerçek fiyat ve içerik girilene kadar ürün satışa hazır değildir. Oluşturmayı bir güncelleme çağrısı takip etmelidir.
Dönemsel fiyatlandırma, metrik fiyatlandırma, modül yapılandırması ve lisans parametreleri bu uçtan düzenlenmez. Bunlar mevcut değerleriyle yeniden yazılır, yani gövdenizde olmamaları onları silmez. Kendi uçlarında yönetilirler.
Detayda dönen module_data ve options alanlarının içeriği bağlı modüle ve ürün tipine göre değişir; sabit bir şemaları yoktur. Bunlara doğrudan erişen kod modül değişince kırılır, anahtar varlığını kontrol edin.
Toplu işlem yalnız durum değiştirir. Ürün silmek tek tek yapılır ve her silme gate:product.delete kancasından geçer; bir eklenti veto edebilir.
İlgili Makaleler
Geri bildiriminiz için teşekkürler!
Yukarıda bulamadığınız her şey için destek ekibimiz her zaman yanınızda.