[SOLVED] Call another rest api from my server in Spring-Boot – Stack Overflow


This Content is from Stack Overflow. Question asked by lunarzshine

I want to call another web-api from my backend on a specific request of user.

How can I achieve this in Ktor. Like in spring boot we use Rest Template, but how can I do the same in Ktor.

Reference Article for doing the same in spring boot: (Call another rest api from my server in Spring-Boot)


This website has some nice examples for using spring’s RestTemplate.
Here is a code example of how it can work to get a simple object:

private static void getEmployees()
    final String uri = "http://localhost:8080/springrestexample/employees.xml";

    RestTemplate restTemplate = new RestTemplate();
    String result = restTemplate.getForObject(uri, String.class);


This Question was asked in StackOverflow by Mahdi and Answered by Torsten N. It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?