通过该API接口可以查询到型号、有效购买日期、激活状态、预计购买时间、注册状态、保修状态、保修过期时间、电话技术支持、AppleCare等信息,帮助苹果用户确定iPad、iPod和iPhone是否处于保修期内。注意:本服务MacBook无保修激活信息返回,将用更换机/黑机、监管机/租赁机、官翻机信息替代呈现。
一、使用API
1、请求信息
(1)请求地址:
https://open-api.51gcc.com
(2)请求方法:
POST
(3)请求参数
参数名 | 是否必填 | 说明 | 参数值 |
|---|---|---|---|
| sn | 是 | 序列号 | 设备的序列号 |
| api_id | 是 | api_id | 3 |
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": "activation_status", "text": "激活状态", "value": "已激活", "notice": "" }, { "key": "warranty_status", "text": "保修状态", "value": "过保", "notice": "" }, { "key": "warranty_year", "text": "保修年数", "value": "1年", "notice": "" }, { "key": "pre_activated", "text": "预激活状态", "value": "已激活", "notice": "" }, { "key": "coverage_start_date", "text": "保修开始时间", "value": "2024-05-28", "notice": "" }, { "key": "estimated_purchase_date", "text": "预计购买时间", "value": "2024-05-28", "notice": "" }, { "key": "active_date", "text": "激活日期", "value": "2024-05-28", "notice": "" }, { "key": "telephone_technical_support", "text": "电话技术支持", "value": "否", "notice": "" }, { "key": "any_time", "text": "7X24小时技术支持", "value": "已过期", "notice": "" }, { "key": "express_replacement_service", "text": "快速更换服务", "value": "已过保", "notice": "" }, { "key": "unlimited_repairs_for_accidental_damage", "text": "AppleCare+意外损坏无限次维修", "value": "已过保", "notice": "" }, { "key": "express_replacement", "text": "AppleCare+快速更换服务", "value": "已过保", "notice": "" }, { "key": "repairs_and_service_coverage", "text": "维修和服务", "value": "已过期", "notice": "" }, { "key": "warranty_expires_in", "text": "剩余保修期", "value": "0天", "notice": "" }, { "key": "warranty", "text": "保修服务", "value": "已过保", "notice": "" }, { "key": "applecare", "text": "是否购买AppleCare", "value": "否", "notice": "" }, { "key": "accidental_damage_repairs", "text": "意外损坏保修服务", "value": "已过保", "notice": "" }, { "key": "applecare_eligible", "text": "AppleCare延保服务", "value": "否", "notice": "" }, { "key": "ac_eligible", "text": "在线购买AppleCare的资格", "value": "无资格", "notice": "" }, { "key": "ac_expiry", "text": "AppleCare到期时间", "value": "2025-05-28(购买了AppleCare才显示)", "notice": "" }, { "key": "ac_days_left", "text": "AppleCare剩余天数", "value": "0天(购买了AppleCare才显示)", "notice": "" }, { "key": "valid_purchase_date", "text": "有效购买日期", "value": "是", "notice": "" }, { "key": "warranty_expiration_date", "text": "保修过期时间", "value": "2025-05-27", "notice": "" }, { "key": "note", "text": "备注", "value": "iPhone XR已激活,注册状态有效,购买日期2024-05-28。保修期1年,已过保。未购买AppleCare且无购买资格,所有维修服务已过期,需自费维修。", "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' => '3', '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': '3', '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", "3"); 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()); } }