Import the API Server License

CA Technologies sends the license file to you as an electronic file when you purchase 
Layer7 Live API Creator
. If you received the license but you cannot locate the file, or if you are having difficulties using the license, contact CA Technologies support.
lac52
Layer7 Live API Creator
 requires a valid license to operate properly and for you to be able to manage and change your APIs, even though 
Layer7 Live API Creator
 can run without a license, with an invalid license, or with an expired license.
Layer7 Live API Creator
 requires that you import a valid license (a standard license) only if you are not already licensed under a Portfolio License Agreement (PLA).
For more information about licensing and PLA, see Licensing.
In this article:
 
3
Obtain the License File
CA Technologies sends the license file to you as an electronic file when you purchase 
Layer7 Live API Creator
. If you received the license but you cannot locate the file, or if you are having difficulties using the license, contact CA Technologies support.
Install Licenses
Only system administrators can install licenses. This user requires a password to log in to 
Layer7 Live API Creator
.
You can install a license using one of the following methods:
Import the License Using API Creator
  1. Log in to API Creator as a system administrator ( 
    sa
     ).
    The System Administration Login dialog appears.
  2. Click 
    Upload License
    .
    The License page appears.
  3. Click 
    Upload License
    .
    The Import License dialog opens.
  4. Locate and select the license file that you received from CA Technologies, and then click 
    OK
    .
The API Server license is imported and displays on the License page.
Install the License When you Start API Server
You can install a license file when starting the Java container (for example, Apache Tomcat, Jetty, or Oracle WebLogic) or the Docker container. As 
Layer7 Live API Creator
 starts up the first time, it reads the license file and installs it as the current license.
After 
Layer7 Live API Creator
 has started the first time, we recommend that you remove this environment variable. Keep the environment variable if you want to load another license file.
Follow these steps:
 
  1. Set the value for the 
    LAC_DEFAULT_LICENSE_FILE
     environment variable or Java system property to point to a license file in your startup command. Enter the complete path to a valid license file.
    For example:
    java -DLAC_DEFAULT_LICENSE_FILE=c:/Users/jdoe/LACLicense.txt etc...
  2. Verify that your license file was installed by completing one of the following:
    • Check the output log after the service is up.
    • Log in to API Creator and click the 
      License
       tab.
Install the License Using cURL or Similar Tool
Use the following process to install a license using cURL or similar tool.
Obtain an Authentication Token
The following procedure assumes that the 
sa
 user password is SECRET.
  1. Issue the following command (change the parts in 
    bold
    ):
    curl -d '{"username":"sa","password":"
    SECRET
    "}' -H "Content-type: application/json" \ -X POST >https://api.acme.com/rest/abl/admin/v2/@authentication
    The following response is expected:
    {
    "apikey": "
    94e248b6a192c206e0ea77fdaa7f93b6
    ",
    "expiration": "2017-01-25T02:15:50.088Z",
    "lastLoginTs": "2017-01-24T18:11:34.094Z",
    "lastLoginIP": "123.45.67.89",
    "email": "[email protected]"
    }
  2. Copy the 
    apikey
     value.
Install the License File
The following procedure uses an example 
MyLicense.txt
 file, which is located in the current directory.
Install the license file using the following command, which reformats the license file into JSON and perform a POST. Edit the parts in 
bold
. Append the 
apikey
 value with "
:1
":
(Mac)
cat
MyLicense.txt
| \
# Remove all newlines
tr '\n' ' ' | \
# Escape \r, \n and \t
sed -e 's/\\r/\\\\r/g' | sed -e 's/\\n/\\\\n/g' | sed -e 's/\\t/\\\\t/g' | \
# Replace \" with temporary token
sed -e 's/\\"/XYZZY/g' | \
# Escape all double-quotes
sed -e 's/"/\\"/g' | \
# Restore and escape escaped double quotes
sed -e 's/XYZZY/\\\\\\"/g' | \
# Add prefix and suffix to make this a JSON object
sed -e 's/^/{"license_text": "/' | sed -e 's/$/"}/' | \
# Send it as a REST request
curl -d @- -H "Content-type: application/json" \
-H "Authorization: CALiveAPICreator
94e248b6a192c206e0ea77fdaa7f93b6
:1" \
-X POST
https://api.acme.com
/rest/abl/admin/v2/server_licenses
The following response is expected:
{
"statusCode": 201,
"txsummary": [
{
"@metadata": {
"href": "http://localhost:8080/APIServer/rest/abl/admin/v2/admin:server_licenses/14",
"resource": "admin:server_licenses",
"verb": "INSERT",
etc...
A value of 201 for the 
statusCode
 indicates that the license was installed successfully. 
Install the License File in a Custom WAR File
You can bundle your license file into a specific location in the 
Layer7 Live API Creator
 WAR file. When 
Layer7 Live API Creator
 starts up, if it does not find a license file, 
Layer7 Live API Creator
 installs this license file.
The following procedure assumes that your WAR file is called 
CALiveAPICreator.war
 and that you have reformatted your license file to JSON and the file is called 
MyLicense.json
After you have installed the license file in your custom WAR file, when you start API Server, the WAR loads your license file if the admin database does not contain an existing license.
Prerequisite:
 You have Java JDK installed.
Follow these steps:
 
  1. Copy the WAR file and the 
    MyLicense.json
     license file to the same directory.
  2. Create the following directory structure: 
    WEB-INF/classes/database/admin
    .
  3. Rename your license file from 
    MyLicense.json
     to 
    DefaultLicense.json
     and move it into the 
    WEB-INF/classes/database/admin
     directory.
  4. Replace the 
    DefaultLicense.json
     license file that is located in 
    CALiveAPICreator.war
     file with the 
    DefaultLicense.json
     license file that is located in the 
    WEB-INF/classes/database/admin
     directory by issuing the following command:
    jar uvf CALiveAPICreator.war WEB-INF/classes/database/admin/DefaultLicense.json
  5. (Recommended) Rename the updated WAR, for example, 
    CALiveAPICreator_withLicense.war
    .
The license file is installed in the custom WAR file.