开发文档
- Request URL:http(s)://api.3023data.com + Path & Query String
- Request Header:key: your key
或者使用链接(key in URL)请求,如:
http://api.3023data.com/apple/activationlock?key=key&sn=359167074097936
Request Timeout 超时时间
300秒
为了防止不可预期的苹果网络波动,请设置足够长的超时时间,最长300秒。
并发/线程数 Threads
对于耗时1秒以上的查询,并发/线程数控制在10及以内。
原因:过高并发会导致苹果直接判定为序列号无效。
正则表达式
IMEI | /^[0-9]{15}$/ |
SN | /^[0-9a-zA-Z]{10,12}$/ |
15位数字(IMEI)
10-12位数字字母组合(SN)
PHP
<?php
$key = "your key";
$sn = strtoupper(trim($_GET["sn"]));
if(preg_match("/^[0-9]{15}$/",$sn)){
$isimei = true;
}else if(preg_match("/^[0-9a-zA-Z]{10,12}$/",$sn)){
$issn = true;
}else{
echo "error sn";
exit;
}
$ch = curl_init("http://api.3023data.com/apple/activationlock?sn=".$sn);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HTTPHEADER,array("key: ".$key));
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_DNS_CACHE_TIMEOUT,28800);
curl_setopt($ch,CURLOPT_TIMEOUT,300);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);
$resp = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
$resp = json_decode($resp,true);
print_r($resp);
JAVA
public static void main(String[] args) { String host = "http://api.3023data.com"; String path = "/apple/activationlock"; String method = "GET"; String key = "your key"; Mapheaders = new HashMap (); headers.put("key", key); Map querys = new HashMap (); querys.put("sn", "359167074097936"); try { HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys); System.out.println(response.toString()); //获取response的body //System.out.println(EntityUtils.toString(response.getEntity())); } catch (Exception e) { e.printStackTrace(); } }
Python
import urllib, urllib2, sys import ssl host = 'http://api.3023data.com' path = '/apple/activationlock' method = 'GET' key = 'your key' querys = 'sn=359167074097936' bodys = {} url = host + path + '?' + querys request = urllib2.Request(url) request.add_header('key', key) ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE response = urllib2.urlopen(request, context=ctx) content = response.read() if (content): print(content)
cURL
curl -i -k --get --include 'http://api.3023data.com/apple/activationlock?sn=359167074097936' -H 'key: your key'
Objective-C
NSString *key = @"your key"; NSString *host = @"http://api.3023data.com"; NSString *path = @"/apple/activationlock"; NSString *method = @"GET"; NSString *querys = @"?sn=359167074097936"; NSString *url = [NSString stringWithFormat:@"%@%@%@", host, path , querys]; NSString *bodys = @""; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString: url] cachePolicy:1 timeoutInterval: 5]; request.HTTPMethod = method; [request addValue: [NSString stringWithFormat:@"%@" , key] forHTTPHeaderField: @"key"]; NSURLSession *requestSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; NSURLSessionDataTask *task = [requestSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable body , NSURLResponse * _Nullable response, NSError * _Nullable error) { NSLog(@"Response object: %@" , response); NSString *bodyString = [[NSString alloc] initWithData:body encoding:NSUTF8StringEncoding]; NSLog(@"Response body: %@" , bodyString); }]; [task resume];
公共错误码
错误码 | 原因 | 解决 |
302301 | key required | add key in request header or url |
302302 | invalid key | Console > 查看密钥(Key) |
302303 | 余额不足 | Console > 充值 |
302304 | IP白名单限制 | Console > IP白名单设置 |
302305 | 接口维护 | 联系我们 |
公共错误码不扣费
错误时
{ "code": 错误码, "message": "错误原因" }
Response Header
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 580
Content-Type: application/json
Balance: 5310.25