Appearance
定位 API
定位API提供了多种方式来获取设备或IP的地理位置信息,包括基站/WiFi定位和IP定位。
智能硬件定位 API
接口描述
通过基站或WiFi信息获取当前位置的地理信息。
请求方式
| URL | 请求方式 |
|---|---|
| https://lbs.xiaojukeji.com/api/v2/locrgeo | POST、GET |
请求
查询参数(GET)
| 参数名 | 必选 | 类型 | 描述 | 示例值 |
|---|---|---|---|---|
| key | 是 | string | API Key | YOUR_API_KEY |
| accesstype | 是 | string | 接入网络方式,1-移动网络 2-wifi 3-融合定位 | 1 |
| diu | 否 | string | 设备唯一编号 | 123456 |
| type | 否 | string | 基站类型,0-未知,1-GTW,2-CDMA,3-LTE,默认为2 | 1 |
| bts | 否 | string | 接入基站信息 | 460,1,12345,987654321,-75,1 |
| nearbts | 否 | string | 周边基站信息 | 460,1,12346,987654322,-80,2 |
| historybts | 否 | string | 历史基站信息 | 460,1,12346,987654322,-80,2 |
| mmac | 否 | string | 已连接WiFi信息 | 00:1A:2B:3C:4D:5E,-45,TP-Link_5G,60 |
| macs | 否 | string | WiFi列表中的WiFi信息 | 88:6A:D3:4F:2E:1C,-68,HomeWiFi,120 |
请求体参数(POST)
当使用POST方法时,请求体应为 LocRgeoRequest 模型的JSON格式。
请求示例
GET
shell
curl -X GET "https://lbs.xiaojukeji.com/api/v2/locrgeo?key=YOUR_API_KEY&bts=460%2C14183%2C2%2C31322%2C-55%2C0&nearbts=&accesstype=1&type=2"POST
shell
curl -X POST "https://lbs.xiaojukeji.com/api/v2/locrgeo?key=YOUR_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"accesstype": "1",
"bts": "460,14183,2,31322,-55,0",
"nearbts": "",
"type": "2"
}'响应
成功响应为 LocRgeoResponse 模型的JSON格式。
响应示例
json
{
"status": 10000,
"msg": "success",
"trace_id": "0ac5186e67e50a9c190b048d5ef3dab0",
"results": [
{
"city": "石家庄市",
"location": {"lat": 39.868578, "lng": 116.437006},
"poi": "体坛中医医院-南3门",
"province": "河北省",
"radius": 1000
}
]
}IP定位 API
接口描述
通过IP地址,获取其IP所在的大致位置。
请求方式
| URL | 请求方式 |
|---|---|
| https://lbs.xiaojukeji.com/api/v2/iplocation | POST、GET |
请求
查询参数(GET)
| 参数名 | 必选 | 类型 | 描述 | 示例值 |
|---|---|---|---|---|
| key | 是 | string | API Key | YOUR_API_KEY |
| ip | 是 | string | IP地址 | 1.2.3.4 |
请求体参数(POST)
当使用POST方法时,请求体应为JSON对象,包含ip字段。
请求示例
GET
shell
curl -X GET "https://lbs.xiaojukeji.com/api/v2/iplocation?key=YOUR_API_KEY&ip=1.2.3.4"POST
shell
curl -X POST "https://lbs.xiaojukeji.com/api/v2/iplocation?key=YOUR_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"ip": "1.2.3.4"
}'响应
成功响应为 IPLocationRPCResponse 模型的JSON格式。
响应示例
json
{
"status": 10000,
"msg": "success",
"trace_id": "0ac5186e67e50a9c190b048d5ef3dab0",
"results": {
"city": "北京市",
"country": "中国",
"district": "海淀区",
"location": {"lat": 39.986989, "lng": 116.29522},
"province": "北京市"
}
}