# Özel Gruplar

https://dev.wisecp.com/tr/ozel-gruplar

Sabit tiplerin dışındaki ürün ailelerini tutan özel grupları yöneten yedi uç.

## Genel Bakış

Özel grup, sabit tiplerin dışında kalan bir ürün ailesini bir arada tutar. SSL sertifikaları kanonik örnektir: kendi tipi olmayan ürünler bir özel grubun içinde yaşar.

Grup yalnız bir kap değil, aynı zamanda bir vitrin ayarıdır. Ödeme yolları, liste şablonu ve yükseltme izni grup düzeyinde belirlenir ve içindeki tüm ürünleri etkiler.

## Referans

### Grupları Listeleme

get/api/v1/admin/products/special-groups

`Products/GetProductGroupsList` admin sayfalı

Üst seviye özel ürün gruplarını döndürür.

Sorgu parametreleri 3

searchstringGrup başlığında arar.

pageintVarsayılan 1.

limitintVarsayılan 25, en çok 100.

Dönen alanlar data[] — 8

idintGrup kimliği.

keystringGrup anahtarı. Kategori açarken bu değeri kullanırsınız.

titlestringGrup başlığı, geçerli dilde.

routestringAdres parçası.

statusstring`active` ya da `inactive`.

product_countintGruptaki ürün sayısı.

service_countintGruptaki hizmet sayısı. Silmeden önce bakılacak sayı budur.

created_atstringOluşturma zamanı.

Meta 4

totalintSüzgece uyan toplam kayıt.

pageintBulunduğunuz sayfa.

limitintSayfa boyutu.

next_pageintSonraki sayfa. Sıfır son sayfada olduğunuz anlamına gelir.

Hatalar 1

insufficient_scope403Anahtar gerekli kapsamı taşımıyor.

İstek cURL JavaScript PHP (HTTP) PHP (Dahili)

```bash
curl 'https://panel.ornek.com/api/v1/admin/products/special-groups' \
  -H "Authorization: Bearer $API_KEY"
```

```javascript
const res  = await fetch('https://panel.ornek.com/api/v1/admin/products/special-groups', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();
```

```php
$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/special-groups');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
```

```php
$response = Api::Products()->GetProductGroupsList();
```

Yanıt 200

```json
{
  "data": [
    {
      "id": 5,
      "key": "special-5",
      "title": "SSL Certificates",
      "route": "ssl-certificates",
      "status": "active",
      "product_count": 8,
      "service_count": 40,
      "created_at": "2026-01-01 10:00:00"
    }
  ],
  "meta": { "total": 3, "page": 1, "limit": 25, "next_page": 0 }
}
```

### Grup Detayı

get/api/v1/admin/products/special-groups/{id}

`Products/GetProductGroup` admin

Tek bir grubu tüm ayarları ve dil içeriğiyle döndürür.

Dönen alanlar data — 18

idintGrup kimliği.

kindstringGrup tipi anahtarı.

kind_idintÜst grubun kimliği. Üst seviyede sıfır.

parent_idintÜst kategorinin kimliği.

is_categoryboolBu satır kategori mi, yoksa üst seviye grup mu.

group_keystring | nullÜst seviye gruplarda grup anahtarı.

statusstring`active` ya da `inactive`.

visibilitystring`visible` ya da `invisible`.

rankintGörüntülenme sırası.

icon_typestring`font` ya da `image`.

iconstringİkon sınıfı ya da yüklenen görselin adı.

colorstringGrup kartının rengi.

list_templateintListe şablonunun kimliği.

upgradingboolGrup içinde yükseltmeye izin verilir mi.

seo_indexboolArama motorlarına açık mı.

enabled_payment_gatewaysarrayYalnız bu ödeme yollarına izin verir.

disabled_payment_gatewaysarrayBu ödeme yollarını kapatır.

langsobject 7 alanDil kodundan içerik nesnesine eşleme.

titlestringGrup başlığı.

routestringAdres parçası.

sub_titlestringAlt başlık.

contentstringGrup metni.

seo_titlestringArama başlığı.

seo_keywordsstringArama anahtar kelimeleri.

seo_descriptionstringArama açıklaması.

Hatalar 2

not_found404Grup bulunamadı.

insufficient_scope403Anahtar gerekli kapsamı taşımıyor.

İstek cURL JavaScript PHP (HTTP) PHP (Dahili)

```bash
curl 'https://panel.ornek.com/api/v1/admin/products/special-groups/5' \
  -H "Authorization: Bearer $API_KEY"
```

```javascript
const res  = await fetch('https://panel.ornek.com/api/v1/admin/products/special-groups/5', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();
```

```php
$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/special-groups/5');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
```

```php
$response = Api::Products()->GetProductGroup(['id' => 5]);
```

### Grup Oluşturma

post/api/v1/admin/products/special-groups

`Products/CreateProductGroup` admin 201

Üst seviye özel grup açar.

Gövde 14

titleobjectzorunluDil kodundan başlığa eşleme. Geçerli dilin başlığı olmalı.

sub_titleobjectDil kodundan alt başlığa eşleme.

contentobjectDil kodundan grup metnine eşleme.

routeobjectDil kodundan adres parçasına eşleme. Boş bırakırsanız başlıktan üretilir.

statusstring`active` ya da `inactive`.

hiddenboolGrubu vitrinde gizler.

rankintGörüntülenme sırası.

icon_typestring`font` ya da `image`.

iconstringİkon sınıfı.

colorstringKart rengi. Diyez işareti olmadan altı basamak.

list_templateintListe şablonunun kimliği.

upgradingboolGrup içinde yükseltmeye izin verir.

seo_indexboolArama motorlarına açar.

seo_titleobjectDil kodundan arama başlığına eşleme. Anahtar kelimeler ve açıklama ayrı alanlardır.

Dönen alanlar data

dataobjectOluşturulan grup, `201` ile döner. Grup detayı şemasıyla aynıdır.

Hatalar 4

title_required422Geçerli dilde başlık yok.

route_exists422Adres parçası mevcut bir adresle çakışıyor.

sub_title_too_long422Bir `sub_title` değeri 255 karakterden uzun.

create_failed422Oluşturma reddedildi.

insufficient_scope403Anahtar gerekli kapsamı taşımıyor.

İstek cURL JavaScript PHP (HTTP) PHP (Dahili)

```bash
curl -X POST 'https://panel.ornek.com/api/v1/admin/products/special-groups' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"title":{"en":"SSL Certificates"},"status":"active","icon_type":"font","icon":"fa-lock","color":"3366ff"}'
```

```javascript
const res = await fetch('https://panel.ornek.com/api/v1/admin/products/special-groups', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: { en: 'SSL Certificates' },
    status: 'active',
    icon_type: 'font',
    icon: 'fa-lock',
    color: '3366ff',
  }),
});

const body = await res.json();
```

```php
$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/special-groups');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'title'     => ['en' => 'SSL Certificates'],
        'status'    => 'active',
        'icon_type' => 'font',
        'icon'      => 'fa-lock',
        'color'     => '3366ff',
    ]),
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
```

```php
// Yeni grubun anahtari, icine urun ve kategori acarken kullanilir.
$group = Api::Products()->CreateProductGroup([
    'title' => ['en' => 'SSL Certificates'],
]);

Api::Products()->CreateProduct([
    'type'     => 'special',
    'group_id' => $group['data']['id'],
    'name'     => 'Wildcard SSL',
]);
```

### Grubu Güncelleme

patch/api/v1/admin/products/special-groups/{id}

`Products/UpdateProductGroup` admin kısmi güvenli

Gönderdiğiniz alanları uygular, geri kalanını olduğu gibi bırakır.

Gövde 14

titleobjectzorunluDil kodundan başlığa eşleme. Geçerli dilin başlığı olmalı.

sub_titleobjectDil kodundan alt başlığa eşleme.

contentobjectDil kodundan grup metnine eşleme.

routeobjectDil kodundan adres parçasına eşleme. Boş bırakırsanız başlıktan üretilir.

statusstring`active` ya da `inactive`.

hiddenboolGrubu vitrinde gizler.

rankintGörüntülenme sırası.

icon_typestring`font` ya da `image`.

iconstringİkon sınıfı.

colorstringKart rengi. Diyez işareti olmadan altı basamak.

list_templateintListe şablonunun kimliği.

upgradingboolGrup içinde yükseltmeye izin verir.

seo_indexboolArama motorlarına açar.

seo_titleobjectDil kodundan arama başlığına eşleme. Anahtar kelimeler ve açıklama ayrı alanlardır.

Dönen alanlar data

dataobjectGrubun güncel hâli. Grup detayı şemasıyla aynıdır.

Hatalar 4

not_found404Grup bulunamadı.

route_exists422Adres parçası mevcut bir adresle çakışıyor.

sub_title_too_long422Bir `sub_title` değeri 255 karakterden uzun.

update_failed422Güncelleme reddedildi.

insufficient_scope403Anahtar gerekli kapsamı taşımıyor.

İstek cURL JavaScript PHP (HTTP) PHP (Dahili)

```bash
curl -X PATCH 'https://panel.ornek.com/api/v1/admin/products/special-groups/5' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"status":"inactive","color":"ff0000"}'
```

```javascript
const res = await fetch('https://panel.ornek.com/api/v1/admin/products/special-groups/5', {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ status: 'inactive', color: 'ff0000' }),
});

const body = await res.json();
```

```php
$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/special-groups/5');
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',
        'color'  => 'ff0000',
    ]),
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
```

```php
// Sik sorulan sorular, sutunlar ve odeme yollari bu uctan DUZENLENMEZ; korunur.
$response = Api::Products()->UpdateProductGroup([
    'id'     => 5,
    'status' => 'inactive',
]);
```

### Grubu Silme

delete/api/v1/admin/products/special-groups/{id}

`Products/DeleteProductGroup` admin içindekiler de gider

Grubu siler. İçindeki ürünler, alt kategoriler ve görseller de silinir.

Dönen alanlar data — 2

deletedboolSilme başarılı mı.

idintSilinen grubun kimliği.

Hatalar 3

not_found404Grup bulunamadı.

blocked_by_gate422`gate:product.group_delete` kancası işlemi veto etti.

insufficient_scope403Anahtar gerekli kapsamı taşımıyor.

İstek cURL JavaScript PHP (HTTP) PHP (Dahili)

```bash
curl -X DELETE 'https://panel.ornek.com/api/v1/admin/products/special-groups/5' \
  -H "Authorization: Bearer $API_KEY"
```

```javascript
const res = await fetch('https://panel.ornek.com/api/v1/admin/products/special-groups/5', {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${apiKey}` },
});

const body = await res.json();
```

```php
$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/special-groups/5');
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);
```

```php
// Silme gruptaki her seyi goturur — once icerigi sayin.
$group = Api::Products()->GetProductGroupsList()['data'][0];

if ($group['product_count'] > 0 || $group['service_count'] > 0) {
    return;
}

Api::Products()->DeleteProductGroup(['id' => $group['id']]);
```

### Grup Görseli Yükleme

post/api/v1/admin/products/special-groups/{id}/image

`Products/UploadGroupImage` admin iki yuva

Grubun ikonunu ya da başlık arka planını yükler.

Gövde 2

imagestringzorunluGörsel. base64 veri adresi ya da indirilebilir bir bağlantı.

typestringHangi yuvaya yükleneceği: `icon` ya da `header-background`. Varsayılan `icon`.

Dönen alanlar data — 2

typestringYazılan yuva: `icon` ya da `header-background`. Sessiz düşmeyi yakalamak için gönderdiğinizle karşılaştırın.

urlstringSaklanan görselin genel URL'i. Dosya adı rastgele üretilir.

——Her yuva tek bir görsel tutar: yükleme öncekini değiştirir ve dosyasını siler. `header-background` görselleri yapılandırılmış boyutlara ölçeklenir.

Hatalar 5

not_found404Grup bulunamadı.

file_required422Dosya alanı boş.

file_invalid422Dosya çözümlenemedi ya da tipi kabul edilmedi.

file_failed422Dosya saklanamadı.

insufficient_scope403Anahtar gerekli kapsamı taşımıyor.

İstek cURL JavaScript PHP (HTTP) PHP (Dahili)

```bash
curl -X POST 'https://panel.ornek.com/api/v1/admin/products/special-groups/5/image' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"image":"https://cdn.example.com/ssl.png","type":"icon"}'
```

```javascript
const res = await fetch('https://panel.ornek.com/api/v1/admin/products/special-groups/5/image', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    image: 'https://cdn.example.com/ssl.png',
    type: 'icon',
  }),
});

const body = await res.json();
```

```php
$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/special-groups/5/image');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'image' => 'https://cdn.example.com/ssl.png',
        'type'  => 'icon',
    ]),
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
```

```php
$response = Api::Products()->UploadGroupImage([
    'id'    => 5,
    'image' => 'https://cdn.example.com/ssl.png',
    'type'  => 'icon',
]);
```

### Grup Görselini Silme

delete/api/v1/admin/products/special-groups/{id}/image

`Products/DeleteProductGroupImage` admin

Grubun ikonunu ya da başlık arka planını kaldırır.

Sorgu parametreleri 1

typestringHangi yuvanın boşaltılacağı: `icon` ya da `header-background`. Varsayılan `icon`.

Dönen alanlar data — 3

deletedboolSilme başarılı mı.

idintGrup kimliği.

typestringBoşaltılan yuva.

Hatalar 2

not_found404Grup bulunamadı.

insufficient_scope403Anahtar gerekli kapsamı taşımıyor.

İstek cURL JavaScript PHP (HTTP) PHP (Dahili)

```bash
curl -X DELETE -G 'https://panel.ornek.com/api/v1/admin/products/special-groups/5/image' \
  -H "Authorization: Bearer $API_KEY" \
  -d type=icon
```

```javascript
const url = new URL('https://panel.ornek.com/api/v1/admin/products/special-groups/5/image');
url.searchParams.set('type', 'icon');

const res = await fetch(url, {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${apiKey}` },
});

const body = await res.json();
```

```php
$url = 'https://panel.ornek.com/api/v1/admin/products/special-groups/5/image?' . http_build_query(['type' => 'icon']);

$ch = curl_init($url);
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);
```

```php
$response = Api::Products()->DeleteProductGroupImage(['id' => 5], ['type' => 'icon']);
```

## Tuzaklar

> **Silme grubun içindekileri de götürür**
> 
> Grup silindiğinde içindeki ürünler, alt kategoriler ve görseller de silinir. Listedeki `product_count` ve `service_count` alanları tam olarak bunun için oradadır; silmeden önce ikisini de okuyun.

> **Zengin alanlar bu uçtan düzenlenmez**
> 
> Sık sorulan sorular, sütun düzeni, işletme notları ve ödeme yolu listeleri güncelleme gövdesinde yer almaz. Bunlar mevcut değerleriyle korunur, yani göndermemeniz onları silmez. Panelin kendi ekranlarından yönetilirler.

> **Renk diyez işaretsiz verilir**
> 
> Renk alanı altı basamaklı değeri diyez işareti olmadan bekler. Başında işaretle göndermek değerin okunamamasına yol açabilir; yazdıktan sonra detayı okuyup ne kaydedildiğini doğrulayın.

## İlgili Makaleler

- [Ürün Uçları](https://dev.wisecp.com/tr/urun-uclari)
- [Ürün Kategorileri](https://dev.wisecp.com/tr/urun-kategorileri)
