Recently I had to understand what’s the external IP of the server that my vCO was deployed on. Since I did not had SSH access to the machine I wondered how I could do this. It turned out to be as simple as few lines of JavaScript in a vCO action. I used the HTTP REST plugin to make a get request to http://ipecho.net/plain and extract the response.
The code (with dynamically adding and removing REST hosts) :
var host = new RESTHost("IP echo"); host.url = "http://ipecho.net/"; host = RESTHostManager.addHost(host); try { var response = host.createRequest("GET", "plain").execute(); RESTHostManager.removeHost(host.id); return response.contentAsString; } catch (e) { RESTHostManager.removeHost(host.id); throw e; }