SOLVED: Multiple Action Group creation via REST API

Currently, we are using multiple Single Actions to execute more Tasks within a site. Nevertheless the “Multiple Action Group” Action would be more elegant way to trigger those Tasks but I have not found a way how to build a xml to cover this.

I am sending (cURL) folowing XML to the BF server to trigger Single Action:

    <?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
    <SourcedFixletAction>
        <SourceFixlet>
            <Sitename>TestSite</Sitename>
            <FixletID>1</FixletID>
            <Action>Action1</Action>
        </SourceFixlet>
        <Target>
            <ComputerName>COMPUTERNAME1</ComputerName>
        </Target>
    </SourcedFixletAction>
</BES>

Is there a way to build a XML in a way to encapsulate more then 1 FixletID?

You can either make a baseline of your tasks and do a sourcedfixletaction or you can do a multipleactiongroup:

  <xs:complexType name="MultipleActionGroup">
    <xs:sequence>
      <xs:element name="Title" type="ObjectName" minOccurs="0" />
      <xs:element name="Relevance" type="RelevanceString" minOccurs="0" />
      <xs:element name="PreGroupActionScript" type="ActionScript" minOccurs="0" />
      <xs:element name="MemberAction" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="Action">
              <xs:sequence>
                <xs:element name="IncludeInGroupRelevance" type="xs:boolean" minOccurs="0" />
              </xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="PostGroupActionScript" type="ActionScript" minOccurs="0" />
      <xs:element name="Settings" type="ActionSettings" minOccurs="0" />
      <xs:element name="SettingsLocks" type="ActionSettingsLocks" minOccurs="0" />
      <xs:element name="Domain" type="Domain" minOccurs="0" />
      <xs:element name="Target" type="BESActionTarget" minOccurs="0" />
      <xs:element name="SourceFixletID" type="BESActionSourceFixlet" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="SkipUI" type="xs:boolean"/>
  </xs:complexType>

Example:

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
	<MultipleActionGroup>
		<Title>Multiple Action Group</Title>
		<Relevance>true</Relevance>
		<MemberAction>
			<Title>Uninstall - App</Title>
			<Relevance></Relevance>
			<ActionScript MIMEType="application/x-Fixlet-Windows-Shell"></ActionScript>
			<SuccessCriteria Option="OriginalRelevance"></SuccessCriteria>
			<IncludeInGroupRelevance>true</IncludeInGroupRelevance>
		</MemberAction>
		<MemberAction>
			<Title>Uninstall - App</Title>
			<Relevance></Relevance>
			<ActionScript MIMEType="application/x-Fixlet-Windows-Shell"></ActionScript>
			<SuccessCriteria Option="OriginalRelevance"></SuccessCriteria>
			<IncludeInGroupRelevance>true</IncludeInGroupRelevance>
		</MemberAction>
	</MultipleActionGroup>
</BES>

Each memberaction is a fixlet/task in your action group.

XML definitions are available here: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Tivoli%20Endpoint%20Manager/page/BES.xsd

3 Likes

Ok, I see…
This means the XML would has to be defined according to those Fixlets/Tasks which I’d like to execute.
In other words, whatever is in a Fixlet/Task, has to be in the XML definition (same Title, same Relevance, ActionScript, …). Correct?

How to target an endpoint in this XML?
I see an option to add an hostname/computerID in relevance for each fixlet but this does not seems to be the elegant way, how an endpoint could be targeted.

If you look at the XML definition part you’ll see target.

Normally you either specify the computer ID that you want to hit or you write a relevance statement for your targeting

1 Like

Thanks strawgate,
I’ve used the element to target multiple servers like you may see in the following example. Nevertheless, using the Computer IDs would be better (and more secure), but haven’t found the proper element and it’s definition to used IDs. Could you, please, link me where could I get such information?

  ...
         <Target>
            <CustomRelevance>
              exists (hostname) whose (
                it as string as lowercase contains "SERVER1" as lowercase OR
                it as string as lowercase contains "SERVER2" as lowercase OR
                it as string as lowercase contains "SERVER3" as lowercase )
            </CustomRelevance>
        </Target> 
    </MultipleActionGroup> 
</BES>

Here’s how I do it:

<target>
<ComputerID>$ID</ComputerID>
<ComputerID>$ID</ComputerID>
<ComputerID>$ID</ComputerID>
<ComputerID>$ID</ComputerID>
</target>

If you look at the BigFix XML Definitions ( https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Tivoli%20Endpoint%20Manager/page/BES.xsd ) you have the following options:

  <xs:complexType name="BESActionTarget">
    <xs:choice>
      <xs:element name="ComputerName" type="xs:normalizedString" maxOccurs="unbounded" />
      <xs:element name="ComputerID" type="xs:nonNegativeInteger" maxOccurs="unbounded" />
      <xs:element name="CustomRelevance" type="xs:normalizedString" maxOccurs="1"/>
      <xs:element name="AllComputers" type="xs:boolean" maxOccurs="1" />
    </xs:choice>
  </xs:complexType>
2 Likes

That help me a lot to not build the XML definition only, but also to understand how to read the XSD file.
Thanks strawgate! :beers:

2 Likes

It is extremely helpful to learn how to read the XSD since it basically specifies what is required and what is optional.

I definitely find it easier to build a baseline, then use a SourcedFixletAction rather than doing a one-off multi-action group, but both are possible, but a SourcedFixletAction is much easier.

Just a follow up question to this discussion. When specifying the XML elements for a MemberAction in a MultipleActionGroup can just a minimum of elements be specified to identify a fixlet or are there key elements that need be required?

Hi @strawgate
I have a sitename which contains some fixlets
I want to create the Multiple Action Group (MAG) of those fixlets
Any REST call available for doing that?
If not, how can I convert multiple fixlets into a MAG

I managed to submit two actions using successive SourcedFixletAction’s in one XML, not a Multi Action Group as such but may help

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
   <SourcedFixletAction>
     <SourceFixlet>
       <Sitename>ActionSite</Sitename>
       <FixletID>1886</FixletID>
       <Action>Action1</Action>
     </SourceFixlet>
     <Target>
       <ComputerID>123456</ComputerID>
     </Target>
    <Parameter Name="_BESClient_EMsg_Detail">1000</Parameter>
   </SourcedFixletAction>
   <SourcedFixletAction>
     <SourceFixlet>
       <Sitename>ActionSite</Sitename>
       <FixletID>222</FixletID>
       <Action>Action1</Action>
     </SourceFixlet>
     <Target>
       <ComputerID>123456</ComputerID>
     </Target>
    <Parameter Name="_BESClient_EMsg_Detail">1000</Parameter>
   </SourcedFixletAction>
</BES>

In the DeveloperWorks API reference page is this statement - any idea what it means?

Note: You cannot submit a Multiple Action Group using a
MemberAction that contains a FixletSource element. This is relevant to
IEM 9.0 and later.