IP & 手机号 API 文档
365info 提供免费 IP 归属地查询与免费手机号归属地查询服务,支持前台访客查询、服务端接口对接和后台应用接入。本页列出所有接口的请求参数、响应结构、错误码,以及 curl / PHP / Python / Go / C# / Node / Java / ObjectC 共 8 种语言的对接示例。
- 接口地址
- https://api.365info.com
- 支持格式
- JSON
- 请求方式
- GET / POST
- IP 查询示例
- https://api.365info.com/api/v1/ip/query?ip=8.8.8.8&key=YOUR_API_KEY
- 手机号查询示例
- https://api.365info.com/api/v1/phone/query?phone=13888888888&key=YOUR_API_KEY
- 鉴权方式
- Header
X-API-Key,或 QueryStringkey - 返回数据
- {"code":0,"err_code":"","message":"ok","request_id":"req_xxxx","data":{...}}
快速开始
三步完成对接:
- 登录 用户中心 注册账号,在「应用管理」里创建应用,拿到
X-API-Key。 - 拼装请求,把 Key 通过 Header 或 querystring 传过来:
- IP 查询:
https://api.365info.com/api/v1/ip/query?ip=8.8.8.8 - 手机号查询:
https://api.365info.com/api/v1/phone/query?phone=13888888888
- IP 查询:
- 解析返回的 Envelope JSON,根据
code(0为成功)判断结果,再读取data字段。
认证与鉴权
下列接口需要携带 API Key:/api/v1/ip/query、/api/v1/ip/batch、/api/v1/phone/query。/api/v1/ip/my 与 /api/v1/meta/health 无需鉴权。
两种传 Key 方式任选其一:
- HTTP Header:
X-API-Key: YOUR_API_KEY(推荐,生产首选) - QueryString:
?key=YOUR_API_KEY(便于浏览器快速验证)
Key 泄漏处置:登录用户中心「密钥管理」,点击「重置」即可作废旧 Key 并生成新 Key,旧 Key 立即失效。
请求与响应格式
所有 /api/v1/* 接口均返回统一的 Envelope 结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 业务状态码,0 表示成功;非 0 表示业务错误 |
| err_code | string | 错误代号;成功时为空串 |
| message | string | 人类可读的说明 |
| request_id | string | 本次请求的追踪 id,可用于问题定位 |
| data | object | array | 业务数据;失败时可能为空 |
// 成功响应 { "code": 0, "err_code": "", "message": "ok", "request_id": "req_1a2b3c4d", "data": { /* 业务数据 */ } }
// 错误响应 { "code": 401, "err_code": "API_KEY_INVALID", "message": "API Key 无效", "request_id": "req_9f8e7d6c" }
全局错误码
| HTTP | err_code | 说明 |
|---|---|---|
| 400 | IP_REQUIRED | 缺少 ip 参数 |
| 400 | IP_INVALID | IP 参数格式非法 |
| 400 | PHONE_REQUIRED | 缺少 phone 参数 |
| 400 | PHONE_INVALID | 手机号格式非法(应为 1[3-9] 开头的 11 位数字) |
| 400 | INVALID_PARAM | 请求参数不合法(如 batch 时 ips 非数组或为空) |
| 401 | API_KEY_REQUIRED | 需要鉴权的接口缺少 API Key |
| 401 | API_KEY_INVALID | API Key 不存在或已停用 |
| 403 | APP_CAPABILITY_DENIED | 所在应用未开通本接口对应的能力(IP 查询 或 手机号归属地)。请在控制台「应用管理 → 编辑应用」勾选对应能力后重试。 |
| 404 | IP_NOT_FOUND | 数据库未命中该 IP 的归属地 |
| 404 | PHONE_NOT_FOUND | 数据库未命中该手机号段的归属地 |
在线调试
直接在文档页内发起真实请求,下拉选择 IP 查询 或 手机号查询,把 Key 换成你自己的即可。
待执行
curl 示例
响应结果
点击"发起查询"后显示结果
单个 IP 查询
GET
https://api.365info.com/api/v1/ip/query
需要 API Key
查询指定 IPv4/IPv6 地址的归属地、运营商与坐标信息。
请求参数
| 名称 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
| ip | string | 是 | - | 待查询的 IPv4/IPv6 地址,如 8.8.8.8 |
| key | string | 否 | - | API Key;优先使用 Header X-API-Key |
请求示例
curl "https://api.365info.com/api/v1/ip/query?ip=8.8.8.8" \ -H "X-API-Key: YOUR_API_KEY"
<?php
$url = "https://api.365info.com/api/v1/ip/query?ip=8.8.8.8";
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-API-Key: YOUR_API_KEY"],
CURLOPT_TIMEOUT => 10,
]);
$resp = curl_exec($ch);
curl_close($ch);
$data = json_decode($resp, true);
print_r($data);
# pip install requests
import requests
url = "https://api.365info.com/api/v1/ip/query"
headers = {"X-API-Key": "YOUR_API_KEY"}
params = {"ip": "8.8.8.8"}
resp = requests.get(url, headers=headers, params=params, timeout=10)
print(resp.status_code, resp.json())
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.365info.com/api/v1/ip/query?ip=8.8.8.8"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var out map[string]interface{}
_ = json.Unmarshal(body, &out)
fmt.Println(resp.StatusCode, out)
}
// .NET 6+
using System.Net.Http;
var client = new HttpClient();
var url = "https://api.365info.com/api/v1/ip/query?ip=8.8.8.8";
client.DefaultRequestHeaders.Add("X-API-Key", "YOUR_API_KEY");
var resp = await client.GetAsync(url);
var text = await resp.Content.ReadAsStringAsync();
Console.WriteLine((int)resp.StatusCode + " " + text);
// Node.js 18+,原生 fetch
const url = "https://api.365info.com/api/v1/ip/query?ip=8.8.8.8";
const resp = await fetch(url, {
headers: { "X-API-Key": "YOUR_API_KEY" },
});
const data = await resp.json();
console.log(resp.status, data);
// JDK 11+
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Demo {
public static void main(String[] args) throws Exception {
String url = "https://api.365info.com/api/v1/ip/query?ip=8.8.8.8";
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("X-API-Key", "YOUR_API_KEY")
.GET()
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());
}
}
NSString *urlStr = @"https://api.365info.com/api/v1/ip/query?ip=8.8.8.8";
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlStr]];
[req setValue:@"YOUR_API_KEY" forHTTPHeaderField:@"X-API-Key"];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:req
completionHandler:^(NSData *data, NSURLResponse *resp, NSError *err) {
if (err) { NSLog(@"err: %@", err); return; }
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@", json);
}];
[task resume];
响应参数(data 字段)
| 字段 | 类型 | 说明 |
|---|---|---|
| ip | string | 查询的 IP |
| country | string | 国家中文名,如"美国" |
| country_english | string | 国家英文名,如"United States" |
| country_id | string | 国家 ISO 代码 |
| international_code | string | 国际区号,带 + |
| region | string | 省份/州 |
| city | string | 城市 |
| area | string | 行政区/县;可能为空 |
| isp | string | 运营商 / ISP |
| location | string | 拼接后的"国家 · 省 · 市"字符串 |
| coordinates | string | "纬度, 经度",WGS84 |
响应示例
{
"code": 0,
"err_code": "",
"message": "ok",
"request_id": "req_1a2b3c4d",
"data": {
"ip": "8.8.8.8",
"country": "美国",
"country_english": "United States",
"country_id": "US",
"international_code": "+1",
"region": "加利福尼亚州",
"city": "圣克拉拉县",
"area": "",
"isp": "Google LLC",
"location": "美国 · 加利福尼亚州 · 圣克拉拉县",
"coordinates": "37.354113, -121.955174"
}
}
批量 IP 查询
POST
https://api.365info.com/api/v1/ip/batch
需要 API Key
一次请求传入多个 IP,返回数组结构;若某条 IP 格式非法,仅该条 item 返回 err_code,其余正常。
请求参数(Body: application/json)
| 名称 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
| ips | string[] | 是 | - | 待查询 IP 数组;为空或非数组返回 INVALID_PARAM |
请求示例
curl -X POST "https://api.365info.com/api/v1/ip/batch" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"ips":["8.8.8.8","1.1.1.1"]}'
<?php
$url = "https://api.365info.com/api/v1/ip/batch";
$payload = json_encode(["ips" => ["8.8.8.8", "1.1.1.1"]]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: YOUR_API_KEY",
],
]);
$resp = curl_exec($ch);
curl_close($ch);
print_r(json_decode($resp, true));
import requests
url = "https://api.365info.com/api/v1/ip/batch"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY",
}
payload = {"ips": ["8.8.8.8", "1.1.1.1"]}
resp = requests.post(url, headers=headers, json=payload, timeout=10)
print(resp.status_code, resp.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.365info.com/api/v1/ip/batch"
payload, _ := json.Marshal(map[string]interface{}{
"ips": []string{"8.8.8.8", "1.1.1.1"},
})
req, _ := http.NewRequest("POST", url, bytes.NewReader(payload))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}
// .NET 6+
using System.Net.Http;
using System.Text;
var client = new HttpClient();
var url = "https://api.365info.com/api/v1/ip/batch";
var payload = "{\"ips\":[\"8.8.8.8\",\"1.1.1.1\"]}";
var content = new StringContent(payload, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("X-API-Key", "YOUR_API_KEY");
var resp = await client.PostAsync(url, content);
var text = await resp.Content.ReadAsStringAsync();
Console.WriteLine((int)resp.StatusCode + " " + text);
const url = "https://api.365info.com/api/v1/ip/batch";
const resp = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY",
},
body: JSON.stringify({ ips: ["8.8.8.8", "1.1.1.1"] }),
});
const data = await resp.json();
console.log(resp.status, data);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Demo {
public static void main(String[] args) throws Exception {
String url = "https://api.365info.com/api/v1/ip/batch";
String body = "{\"ips\":[\"8.8.8.8\",\"1.1.1.1\"]}";
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());
}
}
NSString *urlStr = @"https://api.365info.com/api/v1/ip/batch";
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlStr]];
req.HTTPMethod = @"POST";
[req setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[req setValue:@"YOUR_API_KEY" forHTTPHeaderField:@"X-API-Key"];
NSDictionary *payload = @{ @"ips": @[@"8.8.8.8", @"1.1.1.1"] };
req.HTTPBody = [NSJSONSerialization dataWithJSONObject:payload options:0 error:nil];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:req
completionHandler:^(NSData *data, NSURLResponse *resp, NSError *err) {
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@", json);
}];
[task resume];
响应参数(data.items[] 每个元素)
| 字段 | 类型 | 说明 |
|---|---|---|
| ip | string | 查询的 IP |
| country | string | 国家中文名 |
| region | string | 省份/州 |
| city | string | 城市 |
| area | string | 行政区;可能为空 |
| isp | string | 运营商 |
| location | string | "国家 · 省 · 市"拼接 |
| err_code | string | 该 IP 解析失败时才有;成功时无此字段 |
| message | string | 同上,失败原因 |
响应示例
{
"code": 0,
"err_code": "",
"message": "ok",
"request_id": "req_5e6f7a8b",
"data": {
"items": [
{
"ip": "8.8.8.8",
"country": "美国",
"region": "加利福尼亚州",
"city": "圣克拉拉县",
"area": "",
"isp": "Google LLC",
"location": "美国 · 加利福尼亚州 · 圣克拉拉县"
},
{
"ip": "1.1.1.1",
"country": "澳大利亚",
"region": "新南威尔士州",
"city": "悉尼",
"area": "",
"isp": "Cloudflare",
"location": "澳大利亚 · 新南威尔士州 · 悉尼"
}
]
}
}
我的 IP
GET
https://api.365info.com/api/v1/ip/my
无需鉴权
返回调用方公网 IP 以及其归属地(基于请求来源自动识别)。
请求参数
无
请求示例
curl "https://api.365info.com/api/v1/ip/my"
<?php $url = "https://api.365info.com/api/v1/ip/my"; $resp = file_get_contents($url); print_r(json_decode($resp, true));
import requests url = "https://api.365info.com/api/v1/ip/my" resp = requests.get(url, timeout=10) print(resp.status_code, resp.json())
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
resp, err := http.Get("https://api.365info.com/api/v1/ip/my")
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}
// .NET 6+ using System.Net.Http; var client = new HttpClient(); var url = "https://api.365info.com/api/v1/ip/my"; var resp = await client.GetAsync(url); var text = await resp.Content.ReadAsStringAsync(); Console.WriteLine((int)resp.StatusCode + " " + text);
const url = "https://api.365info.com/api/v1/ip/my"; const resp = await fetch(url); const data = await resp.json(); console.log(resp.status, data);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Demo {
public static void main(String[] args) throws Exception {
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.365info.com/api/v1/ip/my"))
.GET()
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());
}
}
NSURL *url = [NSURL URLWithString:@"https://api.365info.com/api/v1/ip/my"];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
completionHandler:^(NSData *data, NSURLResponse *resp, NSError *err) {
if (err) { NSLog(@"err: %@", err); return; }
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@", json);
}];
[task resume];
响应参数(data 字段)
与 单个 IP 查询的 data 结构一致。
响应示例
{
"code": 0,
"err_code": "",
"message": "ok",
"request_id": "req_3c4d5e6f",
"data": {
"ip": "203.0.113.25",
"country": "中国",
"region": "广东省",
"city": "深圳市",
"isp": "中国电信",
"location": "中国 · 广东省 · 深圳市"
}
}
单个手机号查询
GET
https://api.365info.com/api/v1/phone/query
需要 API Key
查询 11 位中国大陆手机号的归属地信息,包含省、市、运营商、长途区号、邮编和经纬度。查询键为手机号前 7 位号段(paragraph),同一号段返回一致的归属地结果。
请求参数
| 名称 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
| phone | string | 是 | - | 11 位中国大陆手机号,首位必须为 1,次位 3-9,如 13888888888 |
| key | string | 否 | - | API Key;优先使用 Header X-API-Key |
请求示例
curl "https://api.365info.com/api/v1/phone/query?phone=13888888888" \ -H "X-API-Key: YOUR_API_KEY"
<?php
$url = "https://api.365info.com/api/v1/phone/query?phone=13888888888";
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-API-Key: YOUR_API_KEY"],
CURLOPT_TIMEOUT => 10,
]);
$resp = curl_exec($ch);
curl_close($ch);
$data = json_decode($resp, true);
print_r($data);
# pip install requests
import requests
url = "https://api.365info.com/api/v1/phone/query"
headers = {"X-API-Key": "YOUR_API_KEY"}
params = {"phone": "13888888888"}
resp = requests.get(url, headers=headers, params=params, timeout=10)
print(resp.status_code, resp.json())
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.365info.com/api/v1/phone/query?phone=13888888888"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var out map[string]interface{}
_ = json.Unmarshal(body, &out)
fmt.Println(resp.StatusCode, out)
}
// .NET 6+
using System.Net.Http;
var client = new HttpClient();
var url = "https://api.365info.com/api/v1/phone/query?phone=13888888888";
client.DefaultRequestHeaders.Add("X-API-Key", "YOUR_API_KEY");
var resp = await client.GetAsync(url);
var text = await resp.Content.ReadAsStringAsync();
Console.WriteLine((int)resp.StatusCode + " " + text);
// Node.js 18+,原生 fetch
const url = "https://api.365info.com/api/v1/phone/query?phone=13888888888";
const resp = await fetch(url, {
headers: { "X-API-Key": "YOUR_API_KEY" },
});
const data = await resp.json();
console.log(resp.status, data);
// JDK 11+
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Demo {
public static void main(String[] args) throws Exception {
String url = "https://api.365info.com/api/v1/phone/query?phone=13888888888";
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("X-API-Key", "YOUR_API_KEY")
.GET()
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());
}
}
NSString *urlStr = @"https://api.365info.com/api/v1/phone/query?phone=13888888888";
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlStr]];
[req setValue:@"YOUR_API_KEY" forHTTPHeaderField:@"X-API-Key"];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:req
completionHandler:^(NSData *data, NSURLResponse *resp, NSError *err) {
if (err) { NSLog(@"err: %@", err); return; }
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@", json);
}];
[task resume];
响应参数(data 字段)
| 字段 | 类型 | 说明 |
|---|---|---|
| phone | string | 查询的 11 位手机号 |
| paragraph | string | 命中的 7 位号段(手机号前 7 位) |
| province | string | 省/直辖市中文名,如"云南省" |
| city | string | 城市/地区中文名,如"昆明市" |
| isp | string | 运营商:中国移动 / 中国联通 / 中国电信 / 中国广电 |
| zip_code | string | 邮政编码;可能为空 |
| zone_code | string | 长途区号,如 0871;可能为空 |
| location | string | 拼接后的"省 · 市"字符串 |
| coordinates | string | "纬度, 经度",WGS84,精度 6 位小数;可能为空 |
响应示例
{
"code": 0,
"err_code": "",
"message": "ok",
"request_id": "req_2b3c4d5e",
"data": {
"phone": "13888888888",
"paragraph": "1388888",
"province": "云南省",
"city": "昆明市",
"isp": "中国移动",
"zip_code": "650000",
"zone_code": "0871",
"location": "云南省 · 昆明市",
"coordinates": "24.880095, 102.832891"
}
}
// 错误响应:手机号格式非法 { "code": 400, "err_code": "PHONE_INVALID", "message": "手机号格式非法", "request_id": "req_3c4d5e6f" }
健康检查
GET
https://api.365info.com/api/v1/meta/health
无需鉴权
返回服务状态与当前时间,可用于监控探针或对接联通性自检。
请求参数
无
请求示例
curl "https://api.365info.com/api/v1/meta/health"
<?php $url = "https://api.365info.com/api/v1/meta/health"; $resp = file_get_contents($url); print_r(json_decode($resp, true));
import requests
resp = requests.get("https://api.365info.com/api/v1/meta/health", timeout=5)
print(resp.status_code, resp.json())
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
resp, err := http.Get("https://api.365info.com/api/v1/meta/health")
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}
// .NET 6+
using System.Net.Http;
var client = new HttpClient();
var resp = await client.GetAsync("https://api.365info.com/api/v1/meta/health");
var text = await resp.Content.ReadAsStringAsync();
Console.WriteLine((int)resp.StatusCode + " " + text);
const resp = await fetch("https://api.365info.com/api/v1/meta/health");
const data = await resp.json();
console.log(resp.status, data);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Demo {
public static void main(String[] args) throws Exception {
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.365info.com/api/v1/meta/health"))
.GET()
.build();
HttpResponse<String> resp = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());
}
}
NSURL *url = [NSURL URLWithString:@"https://api.365info.com/api/v1/meta/health"];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
completionHandler:^(NSData *data, NSURLResponse *resp, NSError *err) {
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@", json);
}];
[task resume];
响应参数(data 字段)
| 字段 | 类型 | 说明 |
|---|---|---|
| status | string | 服务状态,正常时为 "ok" |
| time | string | 服务器当前时间,RFC3339 格式 |
响应示例
{
"code": 0,
"err_code": "",
"message": "ok",
"request_id": "req_7a8b9c0d",
"data": {
"status": "ok",
"time": "2026-04-21T10:30:00Z"
}
}
遇到问题?请联系 support@365info.com