一、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);

  

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-10-11
  • 2022-02-25
  • 2021-09-09
  • 2022-01-29
相关资源
相似解决方案