Skip to content

定位 API

定位API提供了多种方式来获取设备或IP的地理位置信息,包括基站/WiFi定位和IP定位。

智能硬件定位 API

接口描述

通过基站或WiFi信息获取当前位置的地理信息。

请求方式

URL请求方式
https://lbs.xiaojukeji.com/api/v2/locrgeoPOST、GET

请求

查询参数(GET)

参数名必选类型描述示例值
keystringAPI KeyYOUR_API_KEY
accesstypestring接入网络方式,1-移动网络 2-wifi 3-融合定位1
diustring设备唯一编号123456
typestring基站类型,0-未知,1-GTW,2-CDMA,3-LTE,默认为21
btsstring接入基站信息460,1,12345,987654321,-75,1
nearbtsstring周边基站信息460,1,12346,987654322,-80,2
historybtsstring历史基站信息460,1,12346,987654322,-80,2
mmacstring已连接WiFi信息00:1A:2B:3C:4D:5E,-45,TP-Link_5G,60
macsstringWiFi列表中的WiFi信息88:6A:D3:4F:2E:1C,-68,HomeWiFi,120

请求体参数(POST)

当使用POST方法时,请求体应为 LocRgeoRequest 模型的JSON格式。

请求示例

shell
curl -X GET "https://lbs.xiaojukeji.com/api/v2/locrgeo?key=YOUR_API_KEY&diu=111&accesstype=3&cdma=1&bts=460%2C1%2C1000%2C1000%2C-30%2C0&nearbts=460%2C1%2C1001%2C1001%2C-30%2C0%7C460%2C1%2C1002%2C1002%2C-30%2C0%7C111%2C%2C%2C-30%2C0"

响应

成功响应为 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/iplocationPOST、GET

请求

查询参数(GET)

参数名必选类型描述示例值
keystringAPI KeyYOUR_API_KEY
ipstringIP地址1.2.3.4

请求体参数(POST)

当使用POST方法时,请求体应为JSON对象,包含ip字段。

请求示例

shell
curl -X GET "https://lbs.xiaojukeji.com/api/v2/iplocation?key=YOUR_API_KEY&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": "北京市"
  }
}