I was able to write a function
CallAPI()
However for some reason it only works as intended when I call it from the init method in main.