I have to call a REST webservice and I am planning to use RestTemplate. I looked at examples on how to make a GET request and they are as shown below.
String result = restTemplate.getForObject("http://example.com/hotels/{hotel}/bookings/{booking}", String.class,"42","21");
In my case the RESTful url is something like below. How do I use RestTemplate in this case?
http://example.com/hotels?state=NY&country=USA
So my question would be how do I send request parameters for GET requests?
the placeholders work the same for either type of url, just do
String result = restTemplate.getForObject("http://example.com/hotels?state={state}&country={country}", String.class,"NY","USA");
or better yet, use a hashmap for real name matching-