API Reference v1.0
Eğitim Ana Site Giriş Yap

Webhook

Olay bazlı bildirimler için webhook yönetimi.

POST /api/v1/webhooks

Webhook Kaydet

Belirtilen olay türü için webhook URL'si kaydeder.

Kimlik doğrulama gerektirir
Parametreler
Parametre Tip Zorunlu Açıklama
url string Zorunlu Webhook URL (HTTPS zorunlu)
olaylar array Zorunlu Dinlenecek olay türleri (fatura.olusturuldu, stok.guncellendi, cari.olusturuldu)
secret string Opsiyonel İmza doğrulama anahtarı
Request Body
{
    "url": "https:\/\/example.com\/webhook",
    "olaylar": [
        "fatura.olusturuldu",
        "stok.guncellendi"
    ],
    "secret": "whsec_xxx"
}
Response 201
{
    "success": true,
    "data": {
        "id": 1,
        "url": "https:\/\/example.com\/webhook",
        "olaylar": [
            "fatura.olusturuldu",
            "stok.guncellendi"
        ]
    },
    "message": "Webhook kaydedildi."
}

GET /api/v1/webhooks

Webhook Listesi

Kayıtlı webhook'ları listeler.

Kimlik doğrulama gerektirir
Response 200
{
    "success": true,
    "data": [
        {
            "id": 1,
            "url": "https:\/\/example.com\/webhook",
            "olaylar": [
                "fatura.olusturuldu"
            ],
            "durum": "aktif"
        }
    ]
}

cURL Örneği

POST /api/v1/webhooks
curl -X POST https://api.pratikesnaf.com/api/v1/webhooks \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"url": "https://example.com/webhook", "olaylar": ["fatura.olusturuldu", "stok.guncellendi"], "secret": "whsec_xxx"}'