taobao.ddy.location.get (位置定位查询接口)

位置定位查询

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
app_name String 必须 appName 时空猎人上申请的应用app key
token String 必须 token 时空猎人上申请的应用对应的token
query UserLocationQuery 必须 查询条件
  • └ id_type
  • String
  • 可选
  • taobao_id
  • taobao_id、alipay_id、utd_id其中之一
  • └ ip
  • String
  • 可选
  • ip
  • ip地址
  • └ start_time
  • Date
  • 可选
  • 2017-05-23 15:12:33
  • 开始时间
  • └ id
  • String
  • 可选
  • id
  • id_type对应的id值
  • └ end_time
  • Date
  • 可选
  • 2017-05-23 15:12:33
  • 结束时间
  • └ query_type
  • String
  • 必须
  • JUST_IP_LOCATION
  • JUST_IP_LOCATION(只通过ip定位)、JUST_USER_REAL_LOCATION(用户实时定位)、USER_LOCATION(结合ip定位与实时定位)其中之一

响应参数

名称 类型 示例值 描述
result UserLocationResult result 返回结果对象
  • pcd
  • Pcd
  • pcd
  • 城市信息
  • └ county_code
  • String
  • countyCode
  • 区编码
  • └ province
  • String
  • province
  • 省名称
  • └ city
  • String
  • city
  • 城市名称
  • └ province_code
  • String
  • provinceCode
  • 省编码
  • └ city_code
  • String
  • cityCode
  • 城市编码
  • └ county
  • String
  • county
  • 区名称
  • └ lng
  • String
  • lng
  • 经度
  • └ confidence
  • String
  • 1
  • 定位数据置信度,越接近1越可信,业务方需根据此值考虑是否用定位结果
  • └ time
  • String
  • time
  • 定位时间
  • └ source
  • String
  • source
  • 定位数据来源
  • └ lat
  • String
  • lat
  • 纬度
  • └ success
  • Boolean
  • true
  • success

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
DdyLocationGetRequest req = new DdyLocationGetRequest();
req.setAppName("appName");
req.setToken("token");
DdyLocationGetRequest.UserLocationQuery obj1 = new DdyLocationGetRequest.UserLocationQuery();
obj1.setIdType("taobao_id");
obj1.setIp("ip");
obj1.setStartTime(StringUtils.parseDateTime("2017-05-23 15:12:33"));
obj1.setId("id");
obj1.setEndTime(StringUtils.parseDateTime("2017-05-23 15:12:33"));
obj1.setQueryType("JUST_IP_LOCATION");
req.setQuery(obj1);
DdyLocationGetResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<ddy_location_get_response>
    <result>
        <pcd>
            <county_code>countyCode</county_code>
            <province>province</province>
            <city>city</city>
            <province_code>provinceCode</province_code>
            <city_code>cityCode</city_code>
            <county>county</county>
        </pcd>
        <lng>lng</lng>
        <confidence>1</confidence>
        <time>time</time>
        <source>source</source>
        <lat>lat</lat>
        <success>true</success>
    </result>
</ddy_location_get_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部