Ana içeriğe geç

Market Oluştur

Bir node için yeni bir market oluşturun.

Endpoint: POST /api/v1/integration/markets

Kimlik Doğrulama: Gerekli (Bearer token)

Gerekli Header'lar:

Authorization: Bearer <access_token>
X-Target-Server: integration

İstek Gövdesi

Not: webhook alanı opsiyoneldir. Market'i webhook yapılandırması ile veya webhook olmadan oluşturabilirsiniz.

Webhook ile:

{
"node_id": "550e8400-e29b-41d4-a716-446655440000",
"domain": "example.com",
"webhook": {
"host": "https://webhook.example.com",
"path": "/webhook",
"method": 1,
"authentication": {
"type": 1,
"username": "user",
"password": "pass"
},
"timeout": 30
}
}

Webhook Olmadan:

{
"node_id": "550e8400-e29b-41d4-a716-446655440000",
"domain": "example.com"
}

İstek Parametreleri

AlanTipGerekliAçıklama
node_idstring (UUID)EvetNode ID
domainstringEvetMarket domain'i
webhookobjectHayırWebhook yapılandırması (opsiyonel)
webhook.hoststringHayırWebhook host URL'i (webhook verilmişse gerekli)
webhook.pathstringHayırWebhook path'i (webhook verilmişse gerekli)
webhook.methodintegerHayırHTTP metodu (1=GET, 2=POST, vb.)
webhook.authenticationobjectHayırKimlik doğrulama yapılandırması
webhook.authentication.typeintegerHayırKimlik doğrulama tipi (1=Basic, 2=Token)
webhook.authentication.usernamestringHayırKullanıcı adı (type=1 ise gerekli)
webhook.authentication.passwordstringHayırŞifre (type=1 ise gerekli)
webhook.timeoutintegerHayırİstek timeout'u saniye cinsinden

Webhook Kimlik Doğrulama

authentication.type alanı webhook için kimlik doğrulama metodunu belirtir:

TipDeğerAçıklama
Basic1HTTP Basic Authentication (username ve password gerektirir)
Token2Token tabanlı kimlik doğrulama (token gerektirir)

Daha fazla detay için Kimlik Doğrulama Tipleri bölümüne bakın.

Yanıt

Durum: 201 Created

Oluşturulan market nesnesini döndürür.

Örnek cURL İsteği

Webhook ile:

curl -X POST https://<base-url>/api/v1/integration/markets \
-H "Authorization: Bearer <access_token>" \
-H "X-Target-Server: integration" \
-H "Content-Type: application/json" \
-d '{
"node_id": "550e8400-e29b-41d4-a716-446655440000",
"domain": "example.com",
"webhook": {
"host": "https://webhook.example.com",
"path": "/webhook",
"method": 1,
"authentication": {
"type": 1,
"username": "user",
"password": "pass"
},
"timeout": 30
}
}'

Webhook Olmadan:

curl -X POST https://<base-url>/api/v1/integration/markets \
-H "Authorization: Bearer <access_token>" \
-H "X-Target-Server: integration" \
-H "Content-Type: application/json" \
-d '{
"node_id": "550e8400-e29b-41d4-a716-446655440000",
"domain": "example.com"
}'