手机号所属地区
# 接口信息
- 接口状态 : 正常
- 请求方式 :
GET
- 返回格式 :
JSON
- 扣除Gong币数 :
1
# 请求地址
http://gateway.gtcbaba.icu/api/phone
1
# 请求参数
参数名 | 必选 | 类型 | 描述 |
---|---|---|---|
phone | 是 | string | 要查询的手机号 |
# 响应参数
参数名称 | 类型 | 描述 |
---|---|---|
code | int | 响应码 |
data.phone | string | 要查询的手机号 |
data.info.op | string | 所属运营商 |
data.info.province | string | 所属省份 |
data.info.city | string | 所属城市 |
data.info.zipcode | string | 邮政编码 |
data.info.areacode | string | 区号 |
message | string | 响应描述 |
# 代码示例
注意 🔔️
没有开发者调用凭证无法调用接口哦!!! 前往个人中心获取开发者凭证 (opens new window)
注入Manager
@Resource
private GtcApiManager gtcApiManager;
1
2
2
- 示例一 :推荐👍
通过yml配置开发者调用凭证
public BasicResponse getPhone() {
PhoneParams phoneParams = new PhoneParams();
phoneParams.setPhone("13337702413");
PhoneRequest phoneRequest = new PhoneRequest();
phoneRequest.setRequestParams(phoneParams);
BasicResponse phoneInfo = null;
try {
phoneInfo = gtcApiManager.getPhone(phoneRequest);
System.out.println("得到手机号信息: " + phoneInfo);
} catch (ApiException e) {
log.error(e.getMessage());
}
return phoneInfo;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
- 示例二:不推荐👎
手动实例化
public BasicResponse getPhone() {
GtcApiClient client = new GtcApiClient("您的AccessKey", "您的SecretKey");
GtcApiManager gtcApiManager = new GtcApiManager();
gtcApiManager.setGtcApiClient(client);
PhoneParams phoneParams = new PhoneParams();
phoneParams.setPhone("13337702413");
PhoneRequest phoneRequest = new PhoneRequest();
phoneRequest.setRequestParams(phoneParams);
BasicResponse phoneInfo = null;
try {
phoneInfo = gtcApiManager.getPhone(phoneRequest);
System.out.println("得到手机号信息: " + phoneInfo);
} catch (ApiException e) {
log.error(e.getMessage());
}
return phoneInfo;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
响应示例:
{
"phone": "13337702413",
"info": {
"op": "中国电信",
"province": "江苏",
"city": "南京",
"zipcode": "210000",
"areacode": "025"
}
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10