Schedule baseline using REST

I generate a bunch of baselines for specific computer groups each month. Today I manually schedule them to run with specific options (reboot, retry it fail, run in a specific window, etc.). I’ve already automated the creation of the baselines, I’d like to add the ability to schedule the Actions at the same time.

When I look at the XML for a manually created action for one of these baselines I see that it contains all of the components that were in the baseline. If I create an XML file to publish with REST do I need to do it the same way to is there a field to specify the source baseline?

I’ve not done that through REST, but I’ve done similar in a console dashboard. What you’re looking for is SourcedFixletAction, it looks like https://developer.bigfix.com/rest-api/restapi_request_new.html has some hints that happens to use SourcedFixletAction as their example.

So close…

When I manually create the action, I dynamically target computers by group on the “Target” tab. How do it do this in REST? I thought I could add a relevance string like “(exists true whose (if true then (member of group 28412 of site “CustomSite_1”) else false))” but that doesn’t seem to work.

In what XML field are you putting the relevance? I seem to recall there are different node names depending on whether you target dynamically, static by property, or by machine list. I should be able to check mine in a bit.

I found that I needed to put CustomRelevance inside of “Target” to make it work properly. However the end result is slightly different from the Actions that I create manually.

For the manual ones, the “Target” tab on the Action shows the group that I selected. For the ones that I’ve created with REST it shows nothing for any of the items listed on that tab, and the box says “This action was targeted using a custom relevance clause that can be viewed in the summary tab”. On the Summary tab, it shows the relevance from the baseline in the “Details” section and also the same relevance in a “Custom Targeting” section.

If I leave out the CustomRelevance in the XML then it shows “All Computers” on the Target tab but the relevance is still shown in the Details section. This makes me think that all computers are going to evaluate the relevance and not just the group that should be targeted. Is that right?

I think that’s right, on both counts. I see the same message as far as not displaying the “Target by Property/Group” in the action details as well.

99% there…

I’m having an issue with the StartDateTimeLocalOffset and EndDateTimeLocalOffset fields.

I have UseUTCTime set to true. Right now it’s 2018/08/14 19:44:26 UTC (2:44 PM local time). My XML has P3DT3H15M34S as the StartDateTimeLocalOffset since I want the action to start at 2018/08/17 23:00:00 UTC. But the action itself shows a start time of 8/17/2018 6:00:01 PM UTC (3 hours, 15 minutes, 34 seconds from the current local time).

I’m sure I’m missing something obvious but I don’t see it.

1 Like

OK, I figured it out. I need to use StartDateTimeOffset and EndDateTimeOffset instead of StartDateTimeLocalOffset and EndDateTimeLocalOffset.

1 Like

Over 4 years later, care to share your code with company specific removed?