Firsatlar API
Satis firsatlarini programatik olarak yonetin.
Endpoints
| Method | Endpoint | Aciklama |
|---|---|---|
| GET | /deals | Firsat listesi |
| POST | /deals | Yeni firsat |
| GET | /deals/:id | Firsat detayi |
| PUT | /deals/:id | Firsat guncelleme |
| DELETE | /deals/:id | Firsat silme |
Firsat Listesi
http
GET /api/v1/dealsQuery Parameters
| Parametre | Tip | Aciklama |
|---|---|---|
| page | number | Sayfa numarasi |
| limit | number | Sayfa basi kayit |
| stage | string | Asama filtresi |
| assignedTo | string | Atanan kisi |
| contactId | string | Kisi ID |
| minValue | number | Minimum deger |
| maxValue | number | Maksimum deger |
Ornek Yanit
json
{
"success": true,
"data": [
{
"id": "deal_abc123",
"name": "Kurumsal Paket Satisi",
"value": 50000,
"currency": "TRY",
"stage": "proposal",
"probability": 60,
"contact": {
"id": "contact_xyz",
"name": "ABC Sirket"
},
"assignedTo": {
"id": "user_123",
"name": "Ahmet Yilmaz"
},
"expectedCloseDate": "2024-02-15",
"createdAt": "2024-01-10T09:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 35
}
}Yeni Firsat
http
POST /api/v1/dealsRequest Body
json
{
"name": "Yeni Proje",
"value": 75000,
"currency": "TRY",
"stage": "lead",
"probability": 20,
"contactId": "contact_xyz",
"assignedTo": "user_123",
"expectedCloseDate": "2024-03-01",
"description": "Kurumsal CRM cozumu",
"customFields": {
"source": "referral",
"competitor": "Rakip A"
}
}Ornek Yanit
json
{
"success": true,
"data": {
"id": "deal_new123",
"name": "Yeni Proje",
"value": 75000,
"stage": "lead",
"createdAt": "2024-01-21T11:00:00Z"
}
}Firsat Detayi
http
GET /api/v1/deals/:idOrnek Yanit
json
{
"success": true,
"data": {
"id": "deal_abc123",
"name": "Kurumsal Paket Satisi",
"value": 50000,
"currency": "TRY",
"stage": "proposal",
"probability": 60,
"contact": {
"id": "contact_xyz",
"firstName": "Ali",
"lastName": "Veli",
"company": "ABC Sirket",
"email": "[email protected]"
},
"assignedTo": {
"id": "user_123",
"name": "Ahmet Yilmaz"
},
"expectedCloseDate": "2024-02-15",
"description": "100 kullanici lisansi",
"activities": [
{
"type": "note",
"content": "Ilk gorusme yapildi",
"createdAt": "2024-01-15T10:00:00Z"
},
{
"type": "stage_change",
"from": "lead",
"to": "contact",
"createdAt": "2024-01-16T09:00:00Z"
}
],
"tasks": [
{
"id": "task_123",
"title": "Teklif hazirlama",
"dueDate": "2024-01-25",
"status": "pending"
}
],
"createdAt": "2024-01-10T09:00:00Z",
"updatedAt": "2024-01-20T14:30:00Z"
}
}Asama Guncelleme
http
PATCH /api/v1/deals/:id/stagejson
{
"stage": "negotiation",
"note": "Fiyat muzakeresine gecildi"
}Mevcut Asamalar
| Asama | Aciklama |
|---|---|
| lead | Yeni firsat |
| contact | Iletisim kuruldu |
| proposal | Teklif gonderildi |
| negotiation | Muzakere |
| won | Kazanildi |
| lost | Kaybedildi |
Firsat Kazanma
http
POST /api/v1/deals/:id/wonjson
{
"closedValue": 48000,
"note": "Indirimli kapanis"
}Firsat Kaybetme
http
POST /api/v1/deals/:id/lostjson
{
"reason": "price",
"competitorName": "Rakip B",
"note": "Fiyat yuksek bulundu"
}Kayip Nedenleri
price- Fiyatcompetitor- Rakip tercihtiming- Zamanlamabudget- Butce yokno_response- Yanit yokother- Diger
Aktivite Ekleme
http
POST /api/v1/deals/:id/activitiesjson
{
"type": "note",
"content": "Musterityle toplanti yapildi"
}Pipeline Ozeti
http
GET /api/v1/deals/pipelineOrnek Yanit
json
{
"success": true,
"data": {
"stages": [
{
"stage": "lead",
"count": 15,
"value": 450000
},
{
"stage": "proposal",
"count": 8,
"value": 320000
}
],
"summary": {
"totalDeals": 35,
"totalValue": 1250000,
"weightedValue": 425000,
"avgDealSize": 35714
}
}
}Webhooks
Firsat olaylari:
deal.created- Firsat olusturuldudeal.updated- Firsat guncellendideal.stage_changed- Asama degistideal.won- Kazanildideal.lost- Kaybedildi
