Add a baseline to a SA Plan via the REST API

I have recently been working with the SA REST API to automate the creation of plans.
I have been able to create plans using Fixlets but now I need to add a baseline to the steps.
I’m using the following xml structure:

<sa-rest
	xmlns="http://iemfsa.tivoli.ibm.com/REST"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<plan name="Test-Plan" domain="ALL CONTENT" pending-restart="PausePlan" version="2.0" source-plan-id="undefined" prefetch="false" source-plan-site-url="undefined">
		<description>SA Plan created via API</description>
		<category />
		<source />
		<source-severity />
		<source-release-date />
		<plan-steps>
			<step id="101">
				<fixlet fixlet-id="12902" site-type="custom" site-name="CustomSiteName" />
				<targets>
					<target-group name="ComputerGroupName" id="11111 />
				</targets>
			</step>
		</plan-steps>
		<execution-order>
			<step id="101" depends="">
				<on-failure action="StopPlan" targets="IncludeFailed" threshold="0" />
			</step>
		</execution-order>
		<plan-settings>
			<boolean-setting name="exclude-non-reporting-endpoint">true</boolean-setting>
		</plan-settings>
	</plan>
</sa-rest>'

The plan is actually “created”, I receive a 200 response code and it shows up in the console but it seems to lack data to be properly handled by the BigFix SA module as everytime I click on it to see the details I get the following error:

image

The error only shows up when I try adding a baseline instead of a regular Fixlet/Task. So I am wondering I need to include additional information when sending the create-plan request, specifically here:

<fixlet fixlet-id="12902" site-type="custom" site-name="CustomSiteName" />

Have you considered using elements of the sample SA Plan: Sample plan: Dynamically Run All Baselines from a Site and Restart the Endpoints ?

Refresh my memory… you’re targeting resource serverautomation/besplan to create the plan, but then as separate step you target resource serverautomation/plan to execute the plan ?
I can successfully create the plan thru serverautomation/besplan, and use it without error. It has the correct targets, and allows me to create an action on it.
Here is mine

<?xml version="1.0" encoding="UTF-8"?>
<sa-rest xmlns="http://iemfsa.tivoli.ibm.com/REST" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<plan name="Test" domain="ALL CONTENT" pending-restart="PausePlan" version="2.0" source-plan-id="undefined" prefetch="false" source-plan-site-url="undefined">
    <description>API Test</description>
    <category></category>
    <source></source>
    <source-severity></source-severity>
    <source-release-date></source-release-date>
    <plan-steps>
        <step id="101">
        <baseline fixlet-id="7208" site-type="custom" site-name="SA-Demo"></baseline>
        <targets>
            <target-computer name="gl1rh86a.gbl.tx.usa" id="1611150090"/>
        </targets>
        </step>
    </plan-steps>
    <execution-order>
        <step id="101" depends="">
            <on-failure action="StopPlan" targets="IncludeFailed" threshold="0"></on-failure>
        </step>
    </execution-order>
    <plan-settings>
        <boolean-setting name="exclude-non-reporting-endpoint">
            <![CDATA[true]]>
        </boolean-setting>
    </plan-settings>
</plan>
</sa-rest>
1 Like

I was able to use the above example to create a plan using baselines. That is hardly documented in the official documentation unless you export and explore the xml definition of plans already created.

2 Likes