🔑 License API Documentation

Comprehensive guide for License Management System API

Version 1.1

📋 Quick Navigation

📖 API Overview

License API v1.1, yazılım lisans yönetimi için tasarlanmış RESTful bir API'dir. Hardware ID tabanlı güvenli aktivasyon sistemi ile yazılımlarınızın yetkisiz kullanımını önler.

🚀 Otomatik Hardware ID

Sistem, ilk aktivasyonda cihazın benzersiz kimliğini otomatik olarak tespit eder ve kaydeder.

🔒 Güvenli Doğrulama

Her doğrulama isteğinde hardware ID kontrolü yapılarak güvenlik sağlanır.

⚡ Rate Limiting

API kötüye kullanımını önlemek için otomatik rate limiting sistemi.

📊 Detaylı Yanıtlar

Tüm endpoint'ler detaylı bilgi ve hata mesajları döner.

Base URL: https://www.bb.oyunbilgisi.com/api/
Content-Type: application/json
Encoding: UTF-8
🔐 Authentication

API v1.1 şu anda açık erişimli olarak çalışmaktadır. Gelecek versiyonlarda API key authentication eklenecektir.

Rate Limiting: Her IP adresi için saatlik istek limitleri bulunmaktadır:
  • Activate: 50 istek/saat
  • Verify: 100 istek/saat
  • Deactivate: 30 istek/saat
🎯 API Endpoints
POST /api/activate.php License Activation

Bir lisansı belirtilen cihazda aktive eder. İlk aktivasyonda hardware ID otomatik olarak kaydedilir.

Request Parameters

Parameter Type Required Description
license_key string Required Aktivasyon yapılacak lisans anahtarı (min. 10 karakter)
hardware_id string Required Cihazın benzersiz donanım kimliği (min. 10 karakter)
email string Required Lisans sahibinin email adresi

Request Example

{
  "license_key": "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456",
  "hardware_id": "HW-L8XQW0-A5F3X7-B9K2M4",
  "email": "user@example.com"
}

Success Response 200 OK

{
  "success": true,
  "message": "License activated successfully",
  "activation_id": 12345,
  "is_first_activation": true,
  "current_activations": 1,
  "remaining_activations": 4,
  "expires_at": "2024-07-21 14:30:00",
  "product_info": {
    "name": "MyApp Pro",
    "version": "2.1.0"
  },
  "license_info": {
    "type": "yearly",
    "email": "user@example.com",
    "created_at": "2024-06-21 14:30:00"
  },
  "version": "1.1"
}

Error Responses

// 404 Not Found - License not found
{
  "success": false,
  "error": "License not found or inactive",
  "version": "1.1"
}

// 400 Bad Request - Hardware ID mismatch
{
  "success": false,
  "error": "Hardware ID mismatch",
  "registered_hardware": "HW-ABC123...",
  "version": "1.1"
}

// 400 Bad Request - Max activations reached
{
  "success": false,
  "error": "Maximum activations reached",
  "current_activations": 5,
  "max_activations": 5,
  "version": "1.1"
}
POST /api/verify.php License Verification

Bir lisansın geçerliliğini ve aktivasyon durumunu kontrol eder.

Request Parameters

Parameter Type Required Description
license_key string Required Doğrulanacak lisans anahtarı
hardware_id string Optional Cihaz doğrulaması için hardware ID

Request Example

{
  "license_key": "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456",
  "hardware_id": "HW-L8XQW0-A5F3X7-B9K2M4"
}

Success Response 200 OK

{
  "success": true,
  "valid": true,
  "license_info": {
    "license_key": "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456",
    "product_name": "MyApp Pro",
    "product_version": "2.1.0",
    "license_type": "yearly",
    "email": "user@example.com",
    "created_at": "2024-06-21 14:30:00",
    "expires_at": "2024-07-21 14:30:00",
    "is_active": true,
    "is_expired": false,
    "hardware_id": "HW-L8XQW0-A5F3X7-B9K2M4",
    "max_activations": 5,
    "current_activations": 1,
    "remaining_activations": 4,
    "email_verified": true
  },
  "checks": {
    "is_active": true,
    "is_expired": false,
    "hardware_match": true,
    "has_activation": true
  },
  "activation_info": {
    "activation_id": 12345,
    "activated_at": "2024-06-21 14:35:00",
    "last_check": "2024-06-21 15:20:00",
    "ip_address": "192.168.1.100"
  },
  "version": "1.1"
}
POST /api/deactivate.php License Deactivation

Belirtilen cihazda aktif olan lisansı deaktive eder.

Request Parameters

Parameter Type Required Description
license_key string Required Deaktive edilecek lisans anahtarı
hardware_id string Required Deaktive edilecek cihazın hardware ID'si

Success Response 200 OK

{
  "success": true,
  "message": "License deactivated successfully",
  "activation_id": 12345,
  "deactivated_at": "2024-06-21 15:30:00",
  "remaining_activations": 5,
  "total_active_activations": 0,
  "version": "1.1"
}
GET /api/info.php API Information

API durumu ve sistem bilgilerini döner.

Success Response 200 OK

{
  "success": true,
  "api_version": "1.1",
  "timestamp": "2024-06-21 15:30:00",
  "server_time": 1719000000,
  "endpoints": {
    "activate": "/api/activate.php",
    "verify": "/api/verify.php",
    "deactivate": "/api/deactivate.php",
    "info": "/api/info.php"
  },
  "system_status": {
    "database": "connected",
    "php_version": "8.1.0",
    "memory_usage": "64.5 MB",
    "uptime": 1719000000
  },
  "statistics": {
    "total_licenses": 1250,
    "active_licenses": 980,
    "total_activations": 1456
  },
  "rate_limits": {
    "activate": "50 requests/hour",
    "verify": "100 requests/hour",
    "deactivate": "30 requests/hour"
  }
}
❌ Error Handling

API v1.1 tutarlı hata yanıtları döner. Tüm hatalar aşağıdaki format'ta gelir:

{
  "success": false,
  "error": "Error message description",
  "version": "1.1"
}

HTTP Status Codes

Status Code Description Common Causes
200 OK Success Request completed successfully
400 Bad Request Invalid request Missing parameters, invalid format, business logic errors
404 Not Found Resource not found License not found, endpoint not exists
405 Method Not Allowed Wrong HTTP method Using GET instead of POST
429 Too Many Requests Rate limit exceeded Too many requests from same IP
500 Internal Server Error Server error Database connection, system errors

Common Error Messages

// Invalid input
{
  "success": false,
  "error": "Missing required field: license_key",
  "version": "1.1"
}

// License issues
{
  "success": false,
  "error": "License has expired",
  "version": "1.1"
}

// Hardware ID problems
{
  "success": false,
  "error": "Hardware ID mismatch",
  "registered_hardware": "HW-ABC123...",
  "version": "1.1"
}

// Rate limiting
{
  "success": false,
  "error": "Rate limit exceeded",
  "version": "1.1"
}
💡 Implementation Examples

JavaScript/Node.js Example

// License activation example
async function activateLicense(licenseKey, hardwareId, email) {
  try {
    const response = await fetch('https://www.bb.oyunbilgisi.com/api/activate.php', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        license_key: licenseKey,
        hardware_id: hardwareId,
        email: email
      })
    });
    
    const result = await response.json();
    
    if (result.success) {
      console.log('License activated successfully!');
      console.log('Activation ID:', result.activation_id);
      console.log('Expires at:', result.expires_at);
      return result;
    } else {
      console.error('Activation failed:', result.error);
      throw new Error(result.error);
    }
  } catch (error) {
    console.error('API Error:', error.message);
    throw error;
  }
}

// License verification example
async function verifyLicense(licenseKey, hardwareId = null) {
  try {
    const payload = { license_key: licenseKey };
    if (hardwareId) payload.hardware_id = hardwareId;
    
    const response = await fetch('https://www.bb.oyunbilgisi.com/api/verify.php', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(payload)
    });
    
    const result = await response.json();
    
    if (result.success && result.valid) {
      console.log('License is valid!');
      return result.license_info;
    } else {
      console.log('License is invalid:', result.error);
      return null;
    }
  } catch (error) {
    console.error('Verification failed:', error.message);
    return null;
  }
}

// Usage
activateLicense('ABCD-EFGH-IJKL-MNOP', 'HW-123456', 'user@example.com')
 .then(result => {
   console.log('Activation successful:', result);
 })
 .catch(error => {
   console.error('Activation failed:', error);
 });

Python Example

import requests
import json

class LicenseAPI:
   def __init__(self, base_url='https://www.bb.oyunbilgisi.com/api/'):
       self.base_url = base_url
       self.session = requests.Session()
       self.session.headers.update({'Content-Type': 'application/json'})
   
   def activate_license(self, license_key, hardware_id, email):
       """Activate a license on specified device"""
       url = f"{self.base_url}activate.php"
       data = {
           'license_key': license_key,
           'hardware_id': hardware_id,
           'email': email
       }
       
       try:
           response = self.session.post(url, json=data)
           result = response.json()
           
           if result.get('success'):
               print(f"License activated successfully! ID: {result.get('activation_id')}")
               return result
           else:
               raise Exception(result.get('error', 'Unknown error'))
               
       except requests.RequestException as e:
           raise Exception(f"API request failed: {str(e)}")
   
   def verify_license(self, license_key, hardware_id=None):
       """Verify license validity"""
       url = f"{self.base_url}verify.php"
       data = {'license_key': license_key}
       if hardware_id:
           data['hardware_id'] = hardware_id
       
       try:
           response = self.session.post(url, json=data)
           result = response.json()
           
           return result.get('success', False) and result.get('valid', False)
           
       except requests.RequestException as e:
           print(f"Verification failed: {str(e)}")
           return False
   
   def deactivate_license(self, license_key, hardware_id):
       """Deactivate license on specified device"""
       url = f"{self.base_url}deactivate.php"
       data = {
           'license_key': license_key,
           'hardware_id': hardware_id
       }
       
       try:
           response = self.session.post(url, json=data)
           result = response.json()
           
           if result.get('success'):
               print("License deactivated successfully!")
               return True
           else:
               raise Exception(result.get('error', 'Unknown error'))
               
       except requests.RequestException as e:
           raise Exception(f"API request failed: {str(e)}")

# Usage example
api = LicenseAPI()

try:
   # Activate license
   result = api.activate_license(
       'ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456',
       'HW-PYTHON-123456-ABCDEF',
       'user@example.com'
   )
   
   # Verify license
   is_valid = api.verify_license(
       'ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456',
       'HW-PYTHON-123456-ABCDEF'
   )
   
   print(f"License is valid: {is_valid}")
   
except Exception as e:
   print(f"Error: {e}")

C# Example

using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

public class LicenseAPI
{
   private readonly HttpClient _httpClient;
   private readonly string _baseUrl;

   public LicenseAPI(string baseUrl = "https://www.bb.oyunbilgisi.com/api/")
   {
       _baseUrl = baseUrl;
       _httpClient = new HttpClient();
       _httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json");
   }

   public async Task ActivateLicenseAsync(string licenseKey, string hardwareId, string email)
   {
       var data = new
       {
           license_key = licenseKey,
           hardware_id = hardwareId,
           email = email
       };

       var json = JsonConvert.SerializeObject(data);
       var content = new StringContent(json, Encoding.UTF8, "application/json");

       try
       {
           var response = await _httpClient.PostAsync($"{_baseUrl}activate.php", content);
           var responseJson = await response.Content.ReadAsStringAsync();
           var result = JsonConvert.DeserializeObject(responseJson);

           return result;
       }
       catch (Exception ex)
       {
           throw new Exception($"API request failed: {ex.Message}");
       }
   }

   public async Task VerifyLicenseAsync(string licenseKey, string hardwareId = null)
   {
       var data = new { license_key = licenseKey };
       if (!string.IsNullOrEmpty(hardwareId))
       {
           data = new { license_key = licenseKey, hardware_id = hardwareId };
       }

       var json = JsonConvert.SerializeObject(data);
       var content = new StringContent(json, Encoding.UTF8, "application/json");

       try
       {
           var response = await _httpClient.PostAsync($"{_baseUrl}verify.php", content);
           var responseJson = await response.Content.ReadAsStringAsync();
           dynamic result = JsonConvert.DeserializeObject(responseJson);

           return result.success == true && result.valid == true;
       }
       catch
       {
           return false;
       }
   }

   public void Dispose()
   {
       _httpClient?.Dispose();
   }
}

// Usage example
class Program
{
   static async Task Main(string[] args)
   {
       var api = new LicenseAPI();

       try
       {
           // Activate license
           var result = await api.ActivateLicenseAsync(
               "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456",
               "HW-CSHARP-123456-ABCDEF",
               "user@example.com"
           );

           Console.WriteLine($"Activation result: {result}");

           // Verify license
           var isValid = await api.VerifyLicenseAsync(
               "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456",
               "HW-CSHARP-123456-ABCDEF"
           );

           Console.WriteLine($"License is valid: {isValid}");
       }
       catch (Exception ex)
       {
           Console.WriteLine($"Error: {ex.Message}");
       }
       finally
       {
           api.Dispose();
       }
   }
}

PHP Example

Error: API request failed
🛠 SDKs and Libraries

Çeşitli programlama dilleri için hazır SDK'lar ve kütüphaneler:

📱 .NET SDK

NuGet package olarak .NET Framework ve .NET Core desteği

Install-Package LicenseAPI.NET

🐍 Python SDK

PyPI üzerinden pip ile kurulum

pip install license-api-python

☕ Java SDK

Maven Central'da bulunan Java kütüphanesi

implementation 'com.licenseapi:java-sdk:1.1.0'

🚀 Node.js SDK

NPM üzerinden JavaScript/TypeScript desteği

npm install license-api-js
SDK Geliştirme: Yukarıdaki SDK'lar şu anda geliştirme aşamasındadır. Şimdilik yukarıdaki kod örneklerini kullanabilirsiniz.

Hardware ID Generation

Farklı platformlarda hardware ID oluşturma örnekleri:

// Windows (C#)
string GetHardwareId()
{
   var cpuId = GetCpuId();
   var diskId = GetDiskSerialNumber();
   var motherboardId = GetMotherboardSerialNumber();
   
   return $"HW-{cpuId}-{diskId}-{motherboardId}";
}

// Linux/Mac (Python)
import hashlib
import subprocess

def get_hardware_id():
   # Get system info
   cpu_info = subprocess.check_output("cat /proc/cpuinfo | grep 'Serial'", shell=True)
   disk_info = subprocess.check_output("lsblk -o SERIAL", shell=True)
   
   combined = cpu_info + disk_info
   hardware_hash = hashlib.md5(combined).hexdigest()
   
   return f"HW-LINUX-{hardware_hash[:12].upper()}"

// JavaScript (Electron)
const os = require('os');
const crypto = require('crypto');

function getHardwareId() {
   const networkInterfaces = os.networkInterfaces();
   const cpus = os.cpus();
   
   const hwString = JSON.stringify({
       hostname: os.hostname(),
       cpus: cpus[0].model,
       network: Object.keys(networkInterfaces)
   });
   
   const hash = crypto.createHash('md5').update(hwString).digest('hex');
   return `HW-JS-${hash.substring(0, 12).toUpperCase()}`;
}
🧪 Testing

API'yi test etmek için çeşitli araçlar ve yöntemler:

Canlı Test Panel: https://www.bb.oyunbilgisi.com/api/test.php
Tarayıcınızda canlı olarak tüm endpoint'leri test edebilirsiniz.

cURL Examples

# Activate License
curl -X POST https://www.bb.oyunbilgisi.com/api/activate.php \
 -H "Content-Type: application/json" \
 -d '{
   "license_key": "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456",
   "hardware_id": "HW-CURL-123456-ABCDEF",
   "email": "test@example.com"
 }'

# Verify License
curl -X POST https://www.bb.oyunbilgisi.com/api/verify.php \
 -H "Content-Type: application/json" \
 -d '{
   "license_key": "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456",
   "hardware_id": "HW-CURL-123456-ABCDEF"
 }'

# Get API Info
curl -X GET https://www.bb.oyunbilgisi.com/api/info.php

Postman Collection

Postman için hazır koleksiyon dosyası:

{
 "info": {
   "name": "License API v1.1",
   "description": "Complete API collection for license management",
   "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
 },
 "item": [
   {
     "name": "Activate License",
     "request": {
       "method": "POST",
       "header": [
         {
           "key": "Content-Type",
           "value": "application/json"
         }
       ],
       "body": {
         "mode": "raw",
         "raw": "{\n  \"license_key\": \"{{license_key}}\",\n  \"hardware_id\": \"{{hardware_id}}\",\n  \"email\": \"{{email}}\"\n}"
       },
       "url": {
         "raw": "https://www.bb.oyunbilgisi.com/api/activate.php",
         "host": ["www.bb.oyunbilgisi.com"],
         "path": ["api", "activate.php"]
       }
     }
   }
 ],
 "variable": [
   {
     "key": "license_key",
     "value": "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456"
   },
   {
     "key": "hardware_id", 
     "value": "HW-POSTMAN-123456-ABCDEF"
   },
   {
     "key": "email",
     "value": "test@example.com"
   }
 ]
}

Test Scenarios

Scenario Expected Result Test Data
Valid license activation 200 OK, success: true Valid license key + new hardware ID
Invalid license key 404 Not Found Non-existent license key
Hardware ID mismatch 400 Bad Request Already activated license + different hardware ID
Expired license 400 Bad Request License with past expiry date
Max activations reached 400 Bad Request License with all activations used
Rate limit exceeded 429 Too Many Requests More than 50 requests/hour

🔗 Useful Links

🧪 Test Panel | 📊 API Status | ⚙️ Admin Panel

License API v1.1 - © 2025 www.bb.oyunbilgisi.com
Last updated: 2025-12-22 17:37:07