访问外部接口

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());
posted @ 2021-12-20 17:26  醋醋&油油  阅读(47)  评论(0)    收藏  举报