API文档

用于IMEI数据库访问的RESTful API,具有身份验证和速率限制。

身份验证

所有API请求都需要使用API密钥进行身份验证。获取API密钥的步骤:

  1. api.auth_step1
  2. api.auth_step2
  3. api.auth_step3

api.auth_header

X-API-Key: your-api-key-here

速率限制

api.rate_limit_description

api.rate_limit_response

需要更多配额? 请联系[email protected]讨论增加您的速率限制。

端点

api.imei_lookup_title

GET /api/v1/imei/{imei}

api.imei_lookup_description

参数:
  • imei (string, required): 15-digit IMEI number
示例请求:
curl -H "X-API-Key: your-api-key" \
  https://yoursite.com/api/v1/imei/123456789012345
示例响应:
{
  "imei": "123456789012345",
  "tac": "12345678",
  "manufacturer": "Apple",
  "model_name": "iPhone 12",
  "marketing_name": "iPhone 12",
  "brand_name": "Apple",
  "allocation_date": "2020-10-23",
  "device_type": "Smartphone",
  "operating_system": "iOS",
  "bluetooth": "Yes",
  "nfc": "Yes",
  "wlan": "Yes",
  "calls_remaining": 99
}
api.generate_imei_title

POST /api/v1/generate

api.generate_imei_description

请求正文:
{
  "brand": "Apple",
  "model": "iPhone 12"
}
示例请求:
curl -X POST \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"brand":"Apple","model":"iPhone 12"}' \
  https://yoursite.com/api/v1/generate
示例响应:
{
  "imei": "123456789012345",
  "brand": "Apple",
  "model": "iPhone 12",
  "calls_remaining": 98
}
api.get_brands_title

GET /api/v1/brands

api.get_brands_description

示例请求:
curl -H "X-API-Key: your-api-key" \
  https://yoursite.com/api/v1/brands
示例响应:
{
  "brands": ["Apple", "Samsung", "Google", "OnePlus"],
  "calls_remaining": 97
}
api.get_models_title

GET /api/v1/models/{brand}

api.get_models_description

参数:
  • brand (string, required): Brand name
示例请求:
curl -H "X-API-Key: your-api-key" \
  https://yoursite.com/api/v1/models/Apple
示例响应:
{
  "brand": "Apple",
  "models": ["iPhone 12", "iPhone 12 Pro", "iPhone 13", "iPhone 13 Pro"],
  "calls_remaining": 96
}

api.error_responses

401 Unauthorized
{"error": "API key required"}
{"error": "Invalid API key"}
400 Bad Request
{"error": "Invalid IMEI format"}
{"error": "Brand and model are required"}
404 Not Found
{"error": "IMEI not found"}
429 Too Many Requests
{"error": "Rate limit exceeded"}

api.code_examples

api.php_example
$api_key = 'your-api-key';
$imei = '123456789012345';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://yoursite.com/api/v1/imei/$imei");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: $api_key"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

print_r($data);
api.python_example
import requests

api_key = 'your-api-key'
imei = '123456789012345'

headers = {'X-API-Key': api_key}
response = requests.get(f'https://yoursite.com/api/v1/imei/{imei}', headers=headers)

if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(f'Error: {response.status_code}')
api.javascript_example
const apiKey = 'your-api-key';
const imei = '123456789012345';

fetch(`https://yoursite.com/api/v1/imei/${imei}`, {
    headers: {
        'X-API-Key': apiKey
    }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));