java代码实现百度云存储

 

//新增数据
private void createPoi() throws UnsupportedEncodingException {
BaiduTest test = new BaiduTest();
HttpEntity reqEntity=null;
String url = "http://api.map.baidu.com/geodata/v3/poi/create";
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicNameValuePair("longitude", "11111"));
formparams.add(new BasicNameValuePair("latitude", "111.222"));
formparams.add(new BasicNameValuePair("coord_type", "3"));
formparams.add(new BasicNameValuePair("geotable_id", "23456"));
formparams.add(new BasicNameValuePair("ak", "tgrfdredsrfedseds"));
reqEntity = new UrlEncodedFormEntity(formparams, "utf-8");
test.post(url,reqEntity);
}

 

//查询百度云所有数据

private static String li() throws Exception {
BaiduTest test = new BaiduTest();

String url = "http://api.map.baidu.com/geodata/v3/poi/list?geotable_id=1234&ak=asdfgasdfgsdf&coord_type=3&page_size=10000";
String a = test.httpGet(url);
return a;
}

//更新
private void updatePoi() throws UnsupportedEncodingException {
BaiduTest test = new BaiduTest();
String upurl = "http://api.map.baidu.com/geodata/v3/poi/update";
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicNameValuePair("geotable_id", "12345"));
formparams.add(new BasicNameValuePair("ak", "asdfghjkdsfghsdf"));
formparams.add(new BasicNameValuePair("id", ""));
HttpEntity reqEntity = new UrlEncodedFormEntity(formparams, "utf-8");
test.post(upurl,reqEntity);
}

//删除

private static void deletePoi() throws UnsupportedEncodingException {
BaiduTest test = new BaiduTest();
String url = "http://api.map.baidu.com/geodata/v3/poi/delete";
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicNameValuePair("geotable_id", "12345"));
formparams.add(new BasicNameValuePair("ak", "asdfghjklzxcv"));
//formparams.add(new BasicNameValuePair("is_total_del", "1"));
formparams.add(new BasicNameValuePair("id", "122233"));
HttpEntity reqEntity = new UrlEncodedFormEntity(formparams, "utf-8");
test.post(url,reqEntity);
}

 

//修改列

private static void updateColumn() throws UnsupportedEncodingException {
BaiduTest test = new BaiduTest();

String url = "http://api.map.baidu.com/geodata/v3/column/update";

List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicNameValuePair("geotable_id", "123456"));
formparams.add(new BasicNameValuePair("ak", "qwertyuioasdfghj"));
formparams.add(new BasicNameValuePair("id", "308806"));
formparams.add(new BasicNameValuePair("is_sortfilter_field", "0"));
formparams.add(new BasicNameValuePair("is_search_field", "1"));
formparams.add(new BasicNameValuePair("is_index_field", "1"));
formparams.add(new BasicNameValuePair("is_unique_field", "1"));
HttpEntity reqEntity = new UrlEncodedFormEntity(formparams, "utf-8");

test.post(url,reqEntity);
}

 

//查表

private static void listColumns() throws Exception {
BaiduTest test = new BaiduTest();
String url = "http://api.map.baidu.com/geodata/v3/column/list?geotable_id=1234&ak=qwertyuiAsdfsdfg";
String a = test.httpGet(url);
System.out.println(a);
}

 

具体请看文档,lbs.云存储:http://lbsyun.baidu.com/index.php?title=lbscloud/api/geodataV3

转载于:https://www.cnblogs.com/hzm123/p/7837969.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值