Baseline Creation Rest API

Hi,

I am trying to create Baseline and adding component to that baseline using below method but it is saying Requested resource does not exist, any suggestion?

POST: https://abc.com:52311/api/baselines/CustomSite/hello_customsite


<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
    <Baseline>
       <Title>Custom Baseline Test</Title>
       <Description />
       <Relevance>true</Relevance>
       <BaselineComponentCollection>
          <BaselineComponentGroup>
<BaselineComponent IncludeInRelevance="true" SourceSiteURL="https://abc.com:52311/cgi-bin/bfgather.exe/actionsite" SourceID="211170392" ActionName="Action1" />
       </BaselineComponentCollection>
    </Baseline>
</BES>

At https://developer.bigfix.com/rest-api/api/baseline.html you can expand each of the resources to show examples.

The URL for posting a Baseline would be something like https://abc.com:52311/api/baselines/custom/MySiteName

I believe it is also case-sensitive.

After making suggested change, existing error have been eliminated but now i can see below error.

A baseline component cannot be filled in from source because the provided source link references content that does not exist

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
    <Baseline>
        <Title>Custom Baseline</Title>
        <Description />
        <Relevance>true</Relevance>
        <BaselineComponentCollection>
            <BaselineComponentGroup>
                <BaselineComponent IncludeInRelevance="true" SourceSiteURL="https://abc.com:52311/cgi-bin/bfgather.exe/actionsite" SourceID="50410132203" ActionName="Action1" />
            </BaselineComponentGroup>
        </BaselineComponentCollection>
    </Baseline>
</BES>

Do you have a Fixlet with ID 50410132203 in your Master Action Site?

Yes, even i tried with new Fixlet id 4545 under Master Action site

If you are certain the Fixlet IDs are correct, double check the site URL, including whether it is ‘http’ or ‘https’. I don’t think ‘https’ is common. Note here we are actually referecing the site name, not the protocol, so here ‘http’ is really part of the site name.

You could manually build a baseline in the Console and then export it to see how the site name is defined there for the source link.

I tried your XML, replacing the URL with my actionsite and the Fixlet ID with one of mine. It works with http: but not https: in my environment.

You are right, it should be http, thanks for the helping in this issue.

Secondly any suggestion how to add multiple Fixlet ID’s in same XML?

Third, if the Fixlet is lying in different site, like Patches for RHEL 8 or Patches for Windows then what will be the URL which need to call within XML?

Happy to be able to help!

For multiple Fixlets, you’d use multiple BaselineComponent nodes.
For different external sites, you’d use the gather URL to each site as visible in the Console when highlighting the Site; or create an example Baseline manually and export it as a reference.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
    <Baseline>
        <Title>Custom Baseline</Title>
        <Description />
        <Relevance>true</Relevance>
        <BaselineComponentCollection>
            <BaselineComponentGroup>

                <BaselineComponent IncludeInRelevance="true" SourceSiteURL="http://BES-Dev-Root:52311/cgi-bin/bfgather.exe/actionsite" SourceID="3379" ActionName="Action1" />

<BaselineComponent IncludeInRelevance="true" SourceSiteURL="http://sync.bigfix.com/cgi-bin/bfgather/bessecurity" SourceID="504135507" ActionName="Action1" />

<BaselineComponent IncludeInRelevance="true" SourceSiteURL="http://sync.bigfix.com/cgi-bin/bfgather/updateswindowsapps" SourceID="14011592" ActionName="Action1" />

            </BaselineComponentGroup>
        </BaselineComponentCollection>
    </Baseline>
</BES>

Another way to view all the sites and gather URLs in your deployment, since you’re already using the REST API, is to execute a GET on https://your-root-server:52311/api/sites . That will provide all of your sites in XML format and you can map DisplayName values (as shown in the Console) to the GatherURL values (used when you import the Baseline):