Configuring the BESPluginPortal Plugins through REST API

The plugins configuration can be carried out by issuing BigFix Actions through rest APIs.

The data to be passed to the rest APIs must be a BES XML file.

It is sufficient to create an action script containing the commands for the desired configuration, and then fill the fields of the BES XML for the actions accordingly. An example of such XML is the one below.

<?xml version="1.0" encoding="utf-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=
"http://www.w3.org/2001/XMLSchema" SkipUI="true">
    <SingleAction>
        <Title>test action</Title>
        <Relevance>true</Relevance>
        <ActionScript>
            plugin store "<plugin name>" set "<setting key>" value "<setting value>" on "{parameter "action issue date" of action}"
        </ActionScript>
        <SuccessCriteria />
        <Settings />
        <SettingsLocks />
        <Target>
            <ComputerID>0123456789</ComputerID>
        </Target>
    </SingleAction>
</BES>

The ActionScript element will contain the action script text.

The target of this action should be the Native representation of the BESPluginPortal machine on which the plugins to be configured are installed. As such, it is convenient to use the ComputerID element inside the Target field and fill its value with the appropriate computer ID.

After creating the XML file or the XML string by code, the action described in the XML can be issued by executing a POST.

The following command will execute the POST with cURL. The file action.xml will be posted to the server <server> through port <port> (usually 52311 for BigFix) and it will create and execute the action contained in action.xml.

curl --request POST --data-binary @action.xml --user <username>:<password> https://<server>:<port>/api/actions
curl -X POST -d @action.xml -ku <username>:<password> https://<server>:<port>/api/actions

For more information about the Action REST API resource, see Action or the BES.xsd and BESAPI.xsd files.

Alternatively, you can use the IEM CLI to easily issue requests to BigFix REST APIs.

In order to do that, first open a session with the IEM CLI. Open a terminal and locate the IEM CLI in the BigFix Server folder.

Then, run the following command:

iem login --server=<server>:<port> --user=<user> --password=<password>

Then, after the session is open, simply issue the request with the following command:

iem POST <path to action.xml> /api/actions

For further reference, see Running Requests from the IEM CLI.