Creating an iApps LX block instance using REST APIs

Creating an iApps LX block instance with REST commands provides you with greater configuration flexibilities than using the BIG-IP GUI. You can write your own iApps LX or you can start with one from F5 Networks (mgmt/shared/iapp) and then extend it to create your custom solution. The iApps LX block is based on the iApps LX template which is installed as part of the iApps LX RPM package.

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
  • Ability to edit and send REST commands

Creating an iApps LX package

The template is part of the iApps LX package, along with the processor and any custom GUI configurations. You can create, in any development language, the JSON template and the JavaScript code for the config processor. In addition, you can also include JavaScript code for the audit and stats processors and for a custom GUI. The JSON template must follow the pre-defined structure. For more information about the JSON template and block structure and parameter properties, see iApps LX Block Reference.

To successfully create and deploy an IApps LX block instance,the RPM package must include the config processor configuration. Once all these configurations are saved, they need to be imported. For more information. about the required and optional parts of the RPM package, see Working With iControl LX/iApps LX RPM Packages and What is iApps LX?.

The package content is imported as an RPM package to /var/config/rest/iapps/<name of iApps>.

Note

iApps LX templates saved in another location are not supported and content may be lost during upgrades or during a restore activity.

Tip

Once the package installation is finished, verify that the config processor was successfully installed by navigating to https://<IP of BigIP>/mgmt/toc and searching for a uri ending in the /processors/<name of iApps> If the template includes a custom UI, it should also be accessible.

Creating an iApps LX block instance from the JSON template using REST APIs

Once the iApps LX RPM is saved under /var/config/rest/iapps/<name of iApps>, the JSON template is accessible from mgmt/shared/iapp/blocks. From the template, you create the block instance, with any relevant input properties and by changing the state from TEMPLATE to UNBOUND/BOUND.

  1. Send a GET request to retrieve the relevant template from https://<IP of BigIP>/mgmt/shared/iapp/blocks
  2. Use a PATCH request to update the template with the relevant input properties and change the state from from TEMPLATE to UNBOUND or BOUND.

Tip

To ensure that the system can easily connect the block instance with the relevant template and RPM package, include a “baseReference” property with a “link” to the template as shown in the following example.

},
state: "BOUND",
baseReference: {
link: "https://localhost/mgmt/shared/iapp/blocks/3d546c81-1b1d-3838-b32b-a59d08020d28"
},
  1. Use a POST REST request to create the block instance.

The following is an example of a POST request to instantiate a block:

POST https://<IP address>/mgmt/shared/iapp/blocks
{
   "name": "hello-world-iapp",
   "inputProperties": [
     {
       "id": "Hello",
       "type": "STRING",
       "value": "iApp World",
       "metaData": { }
     }
   ],
   "configurationProcessorReference": {
     "link": "https://localhost/mgmt/shared/iapp/processors/hello-world-js"
   },
   "state": "BINDING"
}
Result:An-auto-generated response shows a unique ID (UUID) for the data block. The modified data block is returned to the block collection (mgmt/shared/iapp/blocks) and the block state is now UNBOUND or BOUND.

Deploying an iApps LX block instance using REST APIs

Note

iApps LX block instances should initially be deployed on a lab environment.

For iApps LX blocks, once a block instance is defined as BOUND/UNBOUND, the system, internally handles the onPOST or OnDELETE API requests. You can verify that the desired action was taken from viewing the block instance.

  1. Send a GET request to retrieve the relevant block instance from : https://<IP of BigIP>/mgmt/shared/iapp/blocks
  2. For a POST request,verify that the state changed from BINDING and then again to BOUND and for a DELETE request, verify that the state changed from UNBINDING to UNBOUND.

Note

If the state shows as ERROR, then investigate the reason for the error. For more information on troubleshooting errors, see Troubleshooting for iApps LX.