import com.baidubce.http.ApiExplorerClient; import com.baidubce.http.AppSigner; import com.baidubce.http.HttpMethodName; import com.baidubce.model.ApiExplorerRequest; import com.baidubce.model.ApiExplorerResponse; // ddm_gps Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "http://gwgp-7n5xm4htmjj.n.bdcloudapi.com/"; ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.GET, path); request.setCredentials("您的 access key", "您的 secret key"); request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8"); request.addQueryParameter("lng", ""); request.addQueryParameter("lat", ""); ApiExplorerClient client = new ApiExplorerClient(new AppSigner()); try { ApiExplorerResponse response = client.sendRequest(request); // 返回结果格式为Json字符串 System.out.println(response.getResult()); } catch (Exception e) { e.printStackTrace(); } } }
点击复制代码
{
"request-id": "A36429E1-C60B-8C9E-E0EB-FD930831473C",
"code": 0,
"message": "Success",
"data": {
"code": "610102",
"region": "陕西省",
"city": "西安市",
"district": "新城区"
}
}
{
"request-id": "EB733231-AAF7-C128-1E88-3310B139226F",
"code": 770,
"message": "Invalid Input",
"data": []
}
IDDMooN多多盟GPS区县定位API接口-百度云 遵守wgs84标准,极速关联GPS的区县位置信息,数据信息实时更新,支持高并发,不限流,动态数据库配有高性能服务器,毫秒级响应速度,让您无需等待。
传统数据定位采用IP地址数据解析,但是IP地址经常会被切换,或者用户使用代理的IP地址。因此采用GPS区县定位能更准确的获取数据信息,为企业带来更高质量的信息服务。
1