Ruby
The following code example is written in the Ruby language:
- require 'net/http'
- # define parts of the SecureKey request URL
- LogiAppURL = "http://<yourServer>/<LogiApp>"
- username = "Bob"
- roles = "Admin"
- rights = "Manager"
- clientaddr = Socket.unpack_sockaddr_in(socket.getpeername) >> ip # ruby v1.9
- # build complete URL to Logi app
- getKeyURL = "/rdTemplate/rdGetSecureKey.aspx?Username=" << username << "&Rights=" << rights+ "&Roles=" << roles << "&ClientBrowserAddress=" << clientaddr finalURL = LogiAppURL << getKeyURL
- # make the SecureKey call and get the response
- result = Net::HTTP.get_response(URI.parse(finalURL))
- sKey = result.body
- print sKey