一、post请求【接口请求参数有params】
RestTemplate restTemplate = new RestTemplate(); String url =domesticAPP_url_Online+"readBook/listReadBookByCode"; JSONObject paramsJ = JSON.parseObject(params); Map map = new HashMap(); map.put("token",LoginToken); MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap(); postParameters.add("params", JSON.toJSONString(map)); //http接口请求类型为json格式 /*调用接口*/ HttpEntity<MultiValueMap<String, Object>> request = new HttpEntity<>(postParameters,headers); JSONObject response = restTemplate.postForObject(url, request, JSONObject.class);