Web access to configuration information for a remote Iguana Server

When one Iguana is talking to another (for example, when starting remote channels), it’s very useful to have programmatic access to the configuration details for the remote server. From Iguana 5.6.6 you can use the Web API call /get_server_config to do this. Basically it loads the IguanaConfiguration.xml file and returns it as a XML string.

Here is an example that loads the local configuration settings:

Screen Shot 2014-06-14 at 13.36.20

Here is the code to try:

local SERVER_URL = 'http://localhost:6543/'

function main(Data)
   
   local Config = net.http.get{url=SERVER_URL..'get_server_config',
      parameters={
         username='admin',
         password='password',
      },live=true}  
   Config = xml.parse{data=Config}
   
   -- Networks can fail so if you want to be cautious
   local Success, Config = pcall(net.http.get, {
         url=SERVER_URL..'get_server_config',
         parameters={username='admin', password='password'},
      live = true}
      )
   if Success then
      -- Use the configuration data 
   else
      -- It failed, we might want to raise an error
   end
end