-1

I am getting the URL dynamically which has few placeholders. But i need to pass the parameters to the placeholders.

Below is the URL which i am getting dynamically

http://example.com/name/{name}/age/{age}

i need to pass parameters for name and age for the above url. How can we achieve that using java.

coder12349
  • 437
  • 2
  • 12
  • 25

1 Answers1

0

I guess you are looking Rest Client to call this URL and get response.

http://example.com/name/{name}/age/{age}

String resourceURL = "http://example.com/name";
ResponseEntity<String> response = restTemplate.getForEntity(resourceURL + "/swarit/age/20", String.class);

I would also suggest to do little research before posting question.

Swarit Agarwal
  • 2,520
  • 1
  • 26
  • 33