Spring RestTemplate post response

前端 未结 2 391
醉梦人生
醉梦人生 2020-12-30 01:25

I\'m not familiar with Spring RestTemplate.

But for this project I have to use Spring RestTemplate to send a POST call to consume a rest api.

I\'m using this

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 02:17

    You use the postForEntity method as follows...

    ResponseEntity response = restTemplate.postForEntity(url+restParm, null, String.class);
    HttpStatus status = response.getStatusCode();
    String restCall = response.getBody();
    

提交回复
热议问题