License Automation Demo
Iguana License Activation
https://www.youtube.com/embed/ryqPzyY0uWAIguana License Transfer
Summary
This document will provide sample code on the basics of the Iguana License API by demonstrating:
How to Activate a New Iguana using the API
How to License Transfer an Iguana using the API
License API Scenarios and Best Practices
How to Activate a New Iguana
Before activating a new Iguana License, we must:
Gain access to the new Iguana Instance ID.
Gain access to the Authentication Token.
Gain access to the Entitlement ID.
Gain access to the code for the new Iguana Instance.
Apply the License Code to the new Iguana Instance
Step 1. Gain access to the new Iguana Instance ID:
local Details = net.http.get{ url = 'http://localhost:7543/license', auth = {username = 'admin',password = 'password'}, live = true } --Get Iguana ID local iguanaID = Details:split("Iguana ID: ")[2]:split("</h2>")[1] trace(iguanaID)
If you run the original API call it will have the url as “http://localhost:7543/license/detail” but when the Iguana instance is not activated it won't return the correct ID. So, using “http://localhost:7543/license” we are returned with a html response that uses string manipulation (Line 7) in order to gain access to the Iguana ID.
Step 2. Gain access to the Authentication Token:
local r,c,h = net.http.post{ url = "https://my.interfaceware.com/api", parameters = { username = 'my.interfaceware.com -- USERNAME', password = 'my.interfaceware.com -- PASSWORD', method = 'session.login' }, live = true } local parsedR = json.parse{data=r} local AuthToken = parsedR.data.Token trace(AuthToken)
The above code will return the Authentication Token using your my.interfaceware.com username and password.
Step 3. Gain access to the Entitlement ID:
--Use this to locate Entitlement ID of Instance Type (ie. Iguana Basic, Iguana Enterprise) local Licenses = net.http.get{ url = "https://my.interfaceware.com/api", parameters = { product = 'Iguana', token = AuthToken, method = 'license.listentitlements' }, live = true } local test = json.parse{data=Licenses} --The [1] will change, on line 15, depending on which entitlement is used. local entitlement = test.data[1].id trace(entitlement)
NOTE: [1] was picked for the example, but make sure you choose the correct data point by looping through and finding correct value based on the name of the Iguana Instance Type.
The above code will return the Entitlement ID of the Iguana Instance Type (ie. Iguana Basic, Iguana Professional, Iguana Enterprise).
Step 4. Gain access to the code for the new Iguana Instance:
Using the Activate API, we will now use the Iguana ID, the Entitlement ID and the Authentication Token. This is to gain access to the code to activate your Iguana Instance.
local Activate = net.http.post{ url = "https://my.interfaceware.com/api", parameters = { product = 'Iguana', token = AuthToken, method = 'license.activate', description = 'license description', entitlementid = entitlement, instanceid = iguanaID }, live = true } local json = json.parse{data=Activate} local code = json.data.code
Once you retrieve the code, you can make the last API call below to activate your new Iguana License.
Step 5. Apply the License Code to the new Iguana Instance:
local Details = net.http.post{ url = 'http://localhost:7543/license/update', auth = {username = 'admin',password = 'password'}, parameters = {key=code}, live = true }
NOTE: Once the last Details API call is used, the iguanaID variable call that retrieved the Iguana ID from the beginning will produce an error.
How to License Transfer an Iguana
To complete a License Transfer using Iguana API follow these steps:
Gain access to the Iguana ID used to transfer to.
Obtain Authentication Token.
Gain Access to the Entitlement ID.
Gain access to the Activation ID of the current Iguana Instance.
Gain access to the new code and transfer the new Iguana Instance.
Apply the license code to the new Iguana Instance.
Step 1. Gain access to the Iguana ID used to transfer to:
If the Iguana Instance is already activated use this:
local Details = net.http.get{ url = 'http://localhost:7543/license/detail', auth = {username = 'admin',password = 'password'}, live = true } local parsedDetails = json.parse{data=Details} local iguanaID = parsedDetails.iguana_id trace(iguanaID)
If the Iguana Instance is new and not activated use this:
local Details = net.http.get{ url = 'http://localhost:7543/license', auth = {username = 'admin',password = 'password'}, live = true } --Get Iguana ID local iguanaID = Details:split("Iguana ID: ")[2]:split("</h2>")[1] trace(iguanaID)
Step 2. Obtain Authentication Token:
local r,c,h = net.http.post{ url = "https://my.interfaceware.com/api", parameters = { username = 'my.interfaceware.com -- USERNAME', password = 'my.interfaceware.com -- PASSWORD', method = 'session.login' }, live = true } local parsedR = json.parse{data=r} local AuthToken = parsedR.data.Token trace(AuthToken)
Step 3. Gain access to the Entitlement ID:
--Use this to locate Entitlement ID of Instance Type (ie. Iguana Basic, Iguana Enterprise) local Licenses = net.http.get{ url = "https://my.interfaceware.com/api", parameters = { product = 'Iguana', token = AuthToken, method = 'license.listentitlements' }, live = true } local test = json.parse{data=Licenses} --The [1] will change, on line 15, depending on which entitlement is used. local entitlement = test.data[1].id trace(entitlement)
Step 4. Gain access to the Activation ID of the current Iguana Instance:
--Used to find activation ID local Activate = net.http.post{ url = "https://my.interfaceware.com/api", parameters = { product = 'Iguana', token = AuthToken, method = 'license.listActivations', entitlementid = entitlement, }, live = true } local parsedActivate = json.parse{data=Activate} local activation = parsedActivate.data[1].activation_id trace(activation)
NOTE: The [1] is used for this demonstration on line 14 but will change depending on which instance you would like to transfer.
Step 5. Gain access to the new code and transfer the new Iguana Instance:
Using the Activation ID, and the Iguana ID you want to transfer to:
local Activate2 = net.http.post{ url = "https://my.interfaceware.com/api", parameters = { product = 'Iguana', token = AuthToken, method = 'license.UpdateActivationInfo', description = 'license description', activationid = activation, instance_id = iguanaID }, live = true } local parsedActivate2 = json.parse{data=Activate2} local newCode = parsedActivate2.data.code trace(newCode)
Step 6. Apply the license code to the new Iguana Instance:
local Details2 = net.http.post{ url = 'http://localhost:8543/license/update', auth = {username = 'admin',password = 'password'}, parameters = {key=newCode}, live = true }
Considerations
Support Other Tools
Using a cURL command in the terminal to access Iguana ID:
curl -X POST http://localhost:6543/license/detail -H "Content-Type: application/json" --user "admin:password"
Using a cURL command in the terminal to access the Authentication Token:
curl -X POST -d 'username=(my.interfaceware.com USERNAME)&password=(my.interfaceware.com PASSWORD)&method=session.login' https://my.interfaceware.com/api