TAMONAY ile gerçekleşen Toplam Satışlar: 5.937.258

API Dokümantasyonu

SMS servisi API'nizi entegre etmek için rehber

Kimlik Doğrulama

Tüm API istekleri Bearer token ile doğrulanmalıdır. Token'ınızı profil sayfanızdan oluşturabilirsiniz.

Örnek Header:

Authorization: Bearer YOUR_API_TOKEN

Base URL

https://www.tamonay.com/api/v1

GET Kullanıcı Bilgileri

/user

Kimlik doğrulaması yapılmış kullanıcının bilgilerini döner.

Örnek İstek:

curl -X GET "https://www.tamonay.com/api/v1/user" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json"

Örnek Yanıt:

{
  "success": true,
  "data": {
    "id": 1,
    "name": "Ahmet",
    "surname": "Yılmaz",
    "email": "ahmet@example.com",
    "balance": "150.00",
    "created_at": "2023-01-01T00:00:00.000000Z"
  }
}

GET Kategoriler

/categories

Tüm kategorileri ve altındaki servisleri listeler.

Örnek İstek:

curl -X GET "https://www.tamonay.com/api/v1/categories" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json"

Örnek Yanıt:

{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Sosyal Medya",
      "slug": "sosyal-medya",
      "services": [
        {
          "id": 1,
          "name": "WhatsApp",
          "category_id": 1,
          "amount": 4.00,
          "quantity": 100
        }
      ]
    }
  ]
}

GET Servisler

/services

Tüm servisleri listeler. amount alanı hesaplanmış fiyatı gösterir.

Örnek Yanıt:

{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "WhatsApp",
      "category_id": 1,
      "category": {
        "id": 1,
        "name": "Sosyal Medya",
        "slug": "sosyal-medya"
      },
      "amount": 4.00,
      "quantity": 100
    }
  ]
}

GET Kategoriye Göre Servisler

/categories/{categoryId}/services

Belirli bir kategorinin servislerini listeler.

POST Sipariş Oluştur

/orders

Yeni bir SMS siparişi oluşturur.

Parametreler:

Parametre Tip Gerekli Açıklama
service_id integer Evet Servis ID'si
operator string Hayır Operatör
forward boolean Hayır SMS yönlendirme

Örnek İstek:

curl -X POST "https://www.tamonay.com/api/v1/orders" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "service_id": 1,
    "operator": "turkcell"
  }'

Örnek Yanıt:

{
  "success": true,
  "message": "Sipariş başarıyla oluşturuldu",
  "data": {
    "id": 123,
    "service_id": 1,
    "operator": "turkcell",
    "phone_number": "+905551234567",
    "status": "active",
    "price": "4.00",
    "created_at": "2023-01-01T12:00:00.000000Z"
  }
}

GET Siparişleri Listele

/orders

Kullanıcının siparişlerini sayfalı olarak listeler.

Query Parametreleri:

  • per_page (opsiyonel): Sayfa başına öğe sayısı (varsayılan: 15)

GET Sipariş Detayı

/orders/{orderId}

Belirli bir siparişin detaylarını getirir.

POST Sipariş Durumunu Güncelle

/orders/{orderId}/update-status

Siparişin durumunu kontrol eder ve günceller.

GET Bakiye Geçmişi

/balance/history

Kullanıcının bakiye işlem geçmişini listeler.

Hata Kodları

HTTP Kodu Açıklama
200 Başarılı istek
201 Kaynak başarıyla oluşturuldu
400 Geçersiz istek parametreleri
401 Kimlik doğrulama hatası
404 Kaynak bulunamadı
500 Sunucu hatası

Örnek Entegrasyon

PHP Örneği:


$token = 'YOUR_API_TOKEN';
$baseUrl = 'https://www.tamonay.com/api/v1';

// Kullanıcı bilgilerini al
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $baseUrl . '/user');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $token,
    'Accept: application/json',
]);

$response = curl_exec($ch);
$userData = json_decode($response, true);
curl_close($ch);

// Sipariş oluştur
$orderData = [
    'service_id' => 1,
    'operator' => 'turkcell'
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $baseUrl . '/orders');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($orderData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $token,
    'Accept: application/json',
    'Content-Type: application/json',
]);

$response = curl_exec($ch);
$orderResult = json_decode($response, true);
curl_close($ch);