Sometimes servers misbehave or users make bad request, so you can receive a response code with some error status, and you need to retry your request to get a successful response.
Write a program that will make GET HTTP requests to http://127.0.0.1:8080/api until the server returns a successful status code (2**), and then print the body of the response as a string.