苹果 · 颜色/容量/型号查询API
2026/9/21 19:47:50 网站建设 项目流程

通过该API接口可以查询到苹果设备的型号、颜色、容量信息。

、使用API

1、请求信息

(1)请求地址:

https://open-api.51gcc.com

(2)请求方法:

POST

(3)请求参数

参数名

是否必填

说明

参数值

sn序列号设备的序列号
api_idapi_id5

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

noticestring对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": "capacity", "text": "容量", "value": "256GB", "notice": "" }, { "key": "color", "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' => '5', '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': '5', '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", "5"); 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()); } }

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询