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
| Alan | Tip | Gerekli | Açıklama |
|---|---|---|---|
node_id | string (UUID) | Evet | Node ID |
domain | string | Evet | Market domain'i |
webhook | object | Hayır | Webhook yapılandırması (opsiyonel) |
webhook.host | string | Hayır | Webhook host URL'i (webhook verilmişse gerekli) |
webhook.path | string | Hayır | Webhook path'i (webhook verilmişse gerekli) |
webhook.method | integer | Hayır | HTTP metodu (1=GET, 2=POST, vb.) |
webhook.authentication | object | Hayır | Kimlik doğrulama yapılandırması |
webhook.authentication.type | integer | Hayır | Kimlik doğrulama tipi (1=Basic, 2=Token) |
webhook.authentication.username | string | Hayır | Kullanıcı adı (type=1 ise gerekli) |
webhook.authentication.password | string | Hayır | Şifre (type=1 ise gerekli) |
webhook.timeout | integer | Hayır | İstek timeout'u saniye cinsinden |
Webhook Kimlik Doğrulama
authentication.type alanı webhook için kimlik doğrulama metodunu belirtir:
| Tip | Değer | Açıklama |
|---|---|---|
| Basic | 1 | HTTP Basic Authentication (username ve password gerektirir) |
| Token | 2 | Token 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"
}'