其他分享
首页 > 其他分享> > 访问外部接口

访问外部接口

作者:互联网

RestTemplate restTemplate = new RestTemplate();
String roomurl = "https://qyapi.weixin.qq.com/cgi-bin/gettoken";
Map<String, Object> map = new HashMap<>();
map.put("corpid", "xxxxxxxx");
map.put("corpsecret", "xxxxxxxxxxxxxxxxxx");
org.springframework.http.HttpEntity<Map> roomentity = new org.springframework.http.HttpEntity<>(map);
JSONObject jsonObject1 = restTemplate.postForObject(roomurl, roomentity, JSONObject.class);
System.out.println(jsonObject1.toString());

标签:map,HttpEntity,http,外部,RestTemplate,接口,访问,new,roomentity
来源: https://www.cnblogs.com/XGKerwin/p/15711797.html