Working with an iAppsLX block instance using REST APIs

As part of managing an iApps LX, you can view, edit, delete, or export an iApps LX using REST APIs.

Prerequisites:

  • Access to a BIG-IP version 14.0
  • Familiarity with the iApps LX concept documentation, with an understanding of iApps LX templates and block instances
  • The iApps LX package (including the data model, JAVA script code for the processors and custom GUI (when relevant))has been saved or imported to /var/config/rest/iapps/<name of iApps>
  • Access to a platform that supports REST commands and familiarity with using HTTP REST commands (POST, GET, PUT,PATCH)

Accessing an iApps LX from the REST catalog

Once an iApps LX RPM is saved under /var/config/rest/iapps/<name of iApps>, the JSON template/block is accessible from mgmt/shared/iapp/blocks. If you know the ID of the data block, then you can use the GET Rest command. Alternatively, you can search in the REST catalog for an iApps LX template/block instance.

  1. Use a Rest GET request to retrieve the relevant data block from https://<BIG-IP>/mgmt/shared/iapp/blocks/<Template UUID> or go to https://<BIG-IP>/mgmt/shared/iapp/blocks to search in the Filter field, for the relevant block.
  2. In the User Name and Password fields, enter your BIG-IP User Name and Password.
  3. In the Filter field, search for the relevant iApp block and then select it.

Modifying an iApps LX block properties using REST APIs

Using a REST API, you can edit properties, such as the inputProperties, of an iApps LX block.

  1. Use the Rest GET request to retrieve the relevant block from https://<BIG-IP>/mgmt/shared/iapp/blocks/<UUID>.
  2. Edit the block parameters.
  3. Use a PATCH/PUT request to update the block to the same URI (https://<BIG-IP>/mgmt/shared/iapp/blocks/<UUID>).

The service is automatically restarted with any changes.

Removing a deployed iApps LX block instance using REST APIs

You can only delete an iApps LX block instance, if it is not currently deployed. You need to first stop the deployment by changing the state to UNBINDING.

  1. Issue a GET request to retrieve the relevant block from https://<BIG-IP>/mgmt/shared/iapp/blocks/<UUID>
  2. Change the state property to UNBINDING
  3. Issue a PATCH/PUT request to deactivate the block instance.
  4. Issue a DELETE request with the payload (the id of the block).
Result:The iApps LX block instance and its stored values are deleted.

The following is an example of a PUT request to deactivate a block, followed by a DELETE request to remove it once it is no longer deployed:

PUT https://<IP address>/mgmt/shared/iapp/blocks
{
  "id": "61a90c30-1d8a-4d62-b79c-0b7f26d53dc4",
  "name": "hello-world-iapp-2",
  "configurationProcessorReference": {
     "link": "https://localhost/mgmt/shared/iapp/processors/hello-world-js"
  },
  "state": "UNBINDING"
}
DELETE https://<IP address>/mgmt/shared/iapp/blocks
{
  "id": "61a90c30-1d8a-4d62-b79c-0b7f26d53dc4"
}

Removing an iApps LX package using REST APIs

In addition to removing an inactive block instance, you can also delete an iApps LX package, assuming that the block instance is not deployed.

  1. Issue a POST request to https://<IP of BigIP>/mgmt/shared/iapp/package-management-tasks with the payload.
  2. Send the following command:
Command Example
 {
   "operation": "UNINSTALL",
   "packageName": "hello-world-0.1.0-0001.noarch"
}

Result:This request unregisters the iApp LX block instance from the REST/GUI, uninstalls the iApps LX RPM file and removes the associated files from the Big-IP/external device’s file system.
  1. Clear the template from the template list:
{"operation": ""}

Note

This request is executed in phases and may take some time. First a 202 accepted response is returned right away with a task ID. The status of the task will be updated when all the steps of the task are completed.

Exporting an iApps LX Package using REST APIs

Exporting an iApps LX package can be helpful when performing an upgrade, as you can export and save the iApps LX package to a temporary location and then reinstall the package when the upgrade is completed. Exporting packages also provides an accessible backup.

  1. Go to https://<BIG-IP>/mgmt/shared/iapp/build-package
  2. Edit the following parameters:
Export RPM Data Parameters
Parameter Name Required/Optional Description
appName Required Equivalent to iApp folder name in /var/config/rest/iapps
specFilePath Optional If not provided, default file path with iAppName used
rpmDescription Optional Default is: Default exported iApp description
rpmSummary Optional Default is: Default exported iApp summary
packageVersion Optional Default is: 0.1.0
packageRelease Optional Default is: 0001
  1. Issue a POST request to create a backup RPM package that is exported to /var/config/rest/iapps/RPMS/ipWorker-0.0.3-0001.noarch.rpm