通过该API接口可以检测iPhone/iPad是否已启用苹果官方「查找我的iPhone」功能,该功能开启后:可通过iCloud远程定位、锁定或抹除设备 ;设备激活锁(Activation Lock)将自动启用 ;未经授权无法抹除设备或关闭查找功能。购买二手设备时,务必确保“查找我的iPhone”已关闭,以避免激活锁导致的无法使用问题。如需检测iMac/MacBook设备,请使用Mac激活锁。
一、使用API
1、请求信息
(1)请求地址:
https://open-api.51gcc.com
(2)请求方法:
POST
(3)请求参数
参数名 | 是否必填 | 说明 | 参数值 |
|---|---|---|---|
| sn | 是 | 序列号或IMEI | 设备的序列号或IMEI |
| api_id | 是 | api_id | 8 |
api_test | 是 | 是否模拟请求返回示例数据。1=是;0=否 | 1 |
api_key | 是 | 用户中心的API密钥 | 自己的API密钥 查看秘钥 |
2、响应结果
(1)结果字段说明:
字段名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
image | string | 设备图片 | https://snapi.51gcc.com/storage/site/no_name.png |
key | string | 字段名 | model |
text | string | 字段含义 | 型号 |
value | string|array | 字段含义对应的查询结果 | iPhone XR |
| notice | string | 对value字段含义的补充说明 | 用于查询保修的凭证号码 |
(2)成功示例:
{ "code": 200, "msg": "ok", "data": { "image": "https://snapi.51gcc.com/storage/site/no_name.png", "result": [ { "key": "model", "text": "型号", "value": "iPhone XR", "notice": "" }, { "key": "imei", "text": "imei", "value": "35859852552XXXX", "notice": "" }, { "key": "imei2", "text": "imei2", "value": "35859852591XXXX", "notice": "" }, { "key": "meid_number", "text": "meid", "value": "3585985255XXXX", "notice": "" }, { "key": "eid_number", "text": "EID", "value": "35859852XXXXXX", "notice": "" }, { "key": "find_my", "text": "激活锁", "value": "开启", "notice": "" } ], "other_result": [] } }(3)失败示例:
{ "code": 403, "msg": "签名错误", "time": 1770703778, "data": [] }(4)状态码说明
状态码 | 说明 |
|---|---|
200 | 请求成功,服务器已成功处理了请求。 |
210 | 参数错误。 |
220 | 系统功能异常。 |
230 | 数据获取失败。 |
403 | 服务器拒绝请求。这可能是由于缺少必要的认证凭据(如API密钥)或权限不足。 |
404 | 请求的资源未找到。请检查您的请求地址是否正确。 |
429 | 请求过于频繁。您已超出速率限制,请稍后再试。 |
500 | 服务器内部错误。服务器在执行请求时遇到了问题。 |
600 | API账户余额不足。 |
二、调用示例
PHP示例
<?php $url = 'https://open-api.51gcc.com'; $params = ['sn' => 'YOUR_VALUE', 'api_id' => '8', 'api_test' => 'YOUR_VALUE', 'api_key' => 'YOUR_VALUE', ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); echo $response; ?>Python示例
import requests url = "https://open-api.51gcc.com" params = { 'sn': 'YOUR_VALUE', 'api_id': '8', 'api_test': 'YOUR_VALUE', 'api_key': 'YOUR_VALUE', } response = requests.post(url, data=params) print(response.text)Java示例
import java.io.*; import java.net.*; import java.util.*; public class ApiClient { public static void main(String[] args) throws Exception { String url = "https://open-api.51gcc.com"; Map<String, String> params = new HashMap<>(); params.put("sn", "YOUR_VALUE"); params.put("api_id", "8"); params.put("api_test", "YOUR_VALUE"); params.put("api_key", "YOUR_VALUE"); URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setDoOutput(true); StringBuilder postData = new StringBuilder(); for (Map.Entry<String, String> param : params.entrySet()) { if (postData.length() != 0) postData.append('&'); postData.append(URLEncoder.encode(param.getKey(), "UTF-8")); postData.append('='); postData.append(URLEncoder.encode(param.getValue(), "UTF-8")); } try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(postData.toString()); } int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } }