Using RestTemplate post request url in Spring with parameters and body

ResponseEntity<String> ss = restTemplate.postForEntity("http://smap-toll/smap/toll/test?ak={1}",new HttpEntity<String>(s), String.class,accessKey);


The first parameter is url ak={1} is a parameter, and {1} is a placeholder, corresponding to the order of the variable parameters that follow.
For example, if I am a parameter here, then the accessKey will be passed to this placeholder.
However, HttpEntity<String>(s) is the content in the body of the http request request. String.class is the type returned by url.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326818671&siteId=291194637