---
title: Webhook'lar
description: Mağaza olaylarına webhook ile abone olun.
full: true
---

## Webhook nesnesi [#Webhook]

**`Webhook`** (v1 · v2)

**Webhook** modelinin açıklaması.

| Alan | Tip | Açıklama |
| --- | --- | --- |
| `createdAt` | `Timestamp` | Kaydın oluşturulma zamanı (milisaniye cinsinden Unix zaman damgası). |
| `deleted` | `Boolean!` | Kaydın silinmiş olup olmadığı. |
| `endpoint` | `String!` | Webhook'ların gönderileceği URL adresi. |
| `id` | `String!` | Kaydın ID değeri. |
| `scope` | `String!` | Webhook içeriğini belirleyen webhook scope'u. |
| `updatedAt` | `Timestamp` | Kaydın son güncellenme zamanı (milisaniye cinsinden Unix zaman damgası). |

Örnek (temsili):

```json
{
  "createdAt": 1735725600000,
  "deleted": false,
  "endpoint": "string",
  "id": "0f9d2c3e-6b1a-4c7e-9a52-3d8e1f4b7c21",
  "scope": "string",
  "updatedAt": 1735725600000
}
```

## Webhook'ları listele [#listWebhook]

**`listWebhook`** (query, v1 · v2)

Uygulamanızın aktif webhook'larını listelemek için bu query'yi kullanın.

Parametreler:

_Parametre yok._

Dönen değer: `[Webhook!]!`

Örnek istek - Webhook Listeleme (`POST https://api.myikas.com/api/v2/admin/graphql`):

Bu API sayesinde, uygulamanıza kayıtlı ikas'ın belirttiğiniz adrese gönderdiği Webhookları görüntüleyebilirsiniz. Yeni Webhook oluşturmak için, bir sonraki örneği kullanabilirsiniz.

```graphql
query ListWebhook {
  listWebhook {
    createdAt
    deleted
    endpoint
    id
    scope
    updatedAt
  }
}
```

Örnek yanıt (temsili):

```json
{
  "data": {
    "listWebhook": [
      {
        "createdAt": 1735725600000,
        "deleted": false,
        "endpoint": "string",
        "id": "0f9d2c3e-6b1a-4c7e-9a52-3d8e1f4b7c21",
        "scope": "string",
        "updatedAt": 1735725600000
      }
    ]
  }
}
```

Örnek istek - Webhook'ları listeleme (`POST https://api.myikas.com/api/v2/admin/graphql`):

```graphql
{
  listWebhook {
    createdAt
    deleted
    endpoint
    id
    scope
    updatedAt
  }
}
```

Örnek yanıt:

```json
{
  "data": {
    "listWebhook": [
      {
        "createdAt": 1636366311914,
        "deleted": false,
        "endpoint": "https://ornek-uygulama.com/api/webhooks/ikas",
        "id": "d8088c99-cfb6-4357-9a5f-c66f310d2e9b",
        "scope": "store/customer/created",
        "updatedAt": 1636366311914
      },
      {
        "createdAt": 1636366311924,
        "deleted": false,
        "endpoint": "https://ornek-uygulama.com/api/webhooks/ikas",
        "id": "5d952fc6-7aba-4885-8095-b46134903fe4",
        "scope": "store/customer/updated",
        "updatedAt": 1636366311924
      }
    ]
  }
}
```

## Webhook'ları kaydet [#saveWebhooks]

**`saveWebhooks`** (mutation, v2)

Birden fazla `scope` değişkeni kullanarak webhook kaydetmek için bu mutation'ı kullanın. Webhook kaydedildikten sonra **ikas**, yeni webhook'ları belirtilen `endpoint` URL'sine göndermeye başlar. **endpoint** erişilemez durumdaysa veya `HTTP 200` dışında bir hata kodu dönerse **ikas** webhook'u 3 kez göndermeyi dener, ardından göndermeyi durdurur.

Yalnızca v2 endpoint'inde: `https://api.myikas.com/api/v2/admin/graphql`

Parametreler:

| Alan | Tip | Açıklama |
| --- | --- | --- |
| `input` (zorunlu) | `WebhookInput!` | İşlemin girdi nesnesi. |

Dönen değer: `[Webhook!]`

Örnek istek - Webhook oluşturma (`POST https://api.myikas.com/api/v2/admin/graphql`):

Sipariş ve ürün değişikliklerini tek bir endpoint'e yönlendirir; böylece ikas API'lerini periyodik olarak sorgulamanıza gerek kalmaz. Webhook'u işlemeden önce HTTP 200 ile yanıt vermeniz gerekir.

```graphql
mutation SaveWebhooks($input: WebhookInput!) {
  saveWebhooks(input: $input) {
    id
    scope
    endpoint
    createdAt
    updatedAt
  }
}
```

```json
{
  "input": {
    "scopes": [
      "store/order/created",
      "store/order/updated",
      "store/product/created",
      "store/product/updated"
    ],
    "endpoint": "https://uygulamam.example.com/webhooks/ikas"
  }
}
```

Örnek yanıt (temsili):

```json
{
  "data": {
    "saveWebhooks": [
      {
        "id": "0f9d2c3e-6b1a-4c7e-9a52-3d8e1f4b7c21",
        "scope": "string",
        "endpoint": "string",
        "createdAt": 1735725600000,
        "updatedAt": 1735725600000
      }
    ]
  }
}
```

## Webhook kaydet [#saveWebhook]

**`saveWebhook`** (mutation, v1)

Birden fazla `scope` değişkeni kullanarak webhook kaydetmek için bu mutation'ı kullanın. Webhook kaydedildikten sonra **ikas**, yeni webhook'ları belirtilen `endpoint` URL'sine göndermeye başlar. **endpoint** erişilemez durumdaysa veya `HTTP 200` dışında bir hata kodu dönerse **ikas** webhook'u 3 kez göndermeyi dener, ardından göndermeyi durdurur.

Yalnızca v1 endpoint'inde: `https://api.myikas.com/api/v1/admin/graphql`. v2 karşılığı: `saveWebhooks`.

Parametreler:

| Alan | Tip | Açıklama |
| --- | --- | --- |
| `input` (zorunlu) | `WebhookInput!` | İşlemin girdi nesnesi. |

Dönen değer: `[Webhook!]`

Örnek istek - Webhook oluşturma (`POST https://api.myikas.com/api/v1/admin/graphql`):

CRM entegrasyonu, yeni müşteri kayıtlarından anında haberdar olmak için `store/customer/created` scope'una webhook tanımlar.

```graphql
mutation SaveWebhook($input: WebhookInput!) {
  saveWebhook(input: $input) {
    id
    scope
    endpoint
    createdAt
    updatedAt
  }
}
```

```json
{
  "input": {
    "scopes": [
      "store/customer/created"
    ],
    "endpoint": "https://uygulamam.example.com/webhooks/ikas"
  }
}
```

Örnek yanıt (temsili):

```json
{
  "data": {
    "saveWebhook": [
      {
        "id": "0f9d2c3e-6b1a-4c7e-9a52-3d8e1f4b7c21",
        "scope": "string",
        "endpoint": "string",
        "createdAt": 1735725600000,
        "updatedAt": 1735725600000
      }
    ]
  }
}
```

## Webhook'u sil [#deleteWebhook]

**`deleteWebhook`** (mutation, v1 · v2)

`scope` listesi vererek webhook'ları silmek için bu mutation'ı kullanın.

Parametreler:

| Alan | Tip | Açıklama |
| --- | --- | --- |
| `scopes` (zorunlu) | `[String!]!` |  |

Dönen değer: `Boolean!`

Örnek istek - Webhook silme (`POST https://api.myikas.com/api/v2/admin/graphql`):

Artık dinlemek istemediğiniz scope'lara ait webhook'ları siler.

```graphql
mutation DeleteWebhook($scopes: [String!]!) {
  deleteWebhook(scopes: $scopes)
}
```

```json
{
  "scopes": [
    "store/customer/created"
  ]
}
```

Örnek yanıt (temsili):

```json
{
  "data": {
    "deleteWebhook": true
  }
}
```
