Ana içeriğe geç

Entegrasyon Oluştur

Yeni entegrasyon oluşturur.

Endpoint

POST /api/v1/integrations

Authentication

Bu endpoint authentication gerektirir.

Header: Authorization: Bearer \{token\}

Permission

  • integrations.create - Tüm entegrasyonları oluşturma
  • integrations.create.own - Sadece kendi entegrasyonunu oluşturma

Request

Headers

HeaderDeğerZorunlu
AuthorizationBearer \{token\}Evet
Content-Typeapplication/jsonEvet

Request Body

ParametreTipZorunluAçıklama
namestringEvetEntegrasyon adı
typestringEvetEntegrasyon tipi (webhook, oauth, api)
providerstringHayırSağlayıcı adı
descriptionstringHayırEntegrasyon açıklaması
configobjectHayırYapılandırma ayarları (JSON)
credentialsobjectHayırKimlik bilgileri (JSON, şifrelenmiş saklanır)
statusstringHayırDurum (active, inactive, error, pending, varsayılan: "pending")
metadataobjectHayırEk metadata bilgileri (JSON)
is_activebooleanHayırAktif durumu (varsayılan: true)

Example Request

{
"name": "Stripe Webhook",
"type": "webhook",
"provider": "stripe",
"description": "Stripe ödeme webhook entegrasyonu",
"config": {
"webhook_url": "https://api.example.com/webhooks/stripe",
"events": ["payment.succeeded", "payment.failed"]
},
"credentials": {
"api_key": "sk_live_..."
},
"status": "pending"
}

Response

Success Response (201 Created)

{
"id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"name": "Stripe Webhook",
"type": "webhook",
"provider": "stripe",
"description": "Stripe ödeme webhook entegrasyonu",
"config": {
"webhook_url": "https://api.example.com/webhooks/stripe",
"events": ["payment.succeeded", "payment.failed"]
},
"status": "pending",
"is_active": true,
"user_id": 1,
"user": {
"id": 1,
"email": "user@example.com"
},
"created_at": "2025-11-20T12:00:00.000000Z",
"updated_at": "2025-11-20T12:00:00.000000Z"
}

Error Responses

403 Forbidden

{
"message": "Forbidden"
}

422 Unprocessable Entity

{
"message": "Validation failed",
"errors": {
"name": ["The name field is required."],
"type": ["The type field is required."]
}
}

Code Examples

cURL

curl -X POST https://api.example.com/api/v1/integrations \
-H "Authorization: Bearer \{token\}" \
-H "Content-Type: application/json" \
-d '{
"name": "Stripe Webhook",
"type": "webhook",
"provider": "stripe",
"description": "Stripe ödeme webhook entegrasyonu",
"status": "pending"
}'

Notes

  • .own permission'ı olan kullanıcılar için user_id otomatik olarak atanır
  • is_active değeri belirtilmemişse varsayılan olarak true kullanılır
  • status değeri belirtilmemişse varsayılan olarak "pending" kullanılır
  • credentials alanı şifrelenerek saklanır, güvenlik için hassas bilgiler içermemelidir