RESTAPI: Is there a way to retrieve the Masthead file for subscribed sites?

I’m trying to create a script to replicate External Site Subscriptions, Custom Sites, and content in the Custom Sites (Analyses/Fixlets/Tasks/Baselines), plus all the Role and Automatic Group configuration information from a Production environment to a Test environment. The idea is to have the script use RestAPI to subscribe any missing sites then wipe out the custom content in Test and copy across the content from the Production site.

I’m using it as an excuse to learn Python and the RestAPI.

I have been told that our Console Operators need to be able to “test” new versions of BigFix before I am going to be allowed to deploy the versions to Production. Having been bitten by the Malicious Compliance bug, I figure the Test Environment should be configured with the same sites, and populated with all the content I can grab from the Production environment. But I’d rather not have to do this manually ever quarter.

I can poll the sites and compare them to see what is missing, but I’m trying to figure out how to use the “masthead of <site>” relevance to see if I can get a copy of the masthead file needed to subscribe the missing sites to the Test Environment.

Anyone have any pointers or suggestions?

1 Like

Tim,
Unfortunately, masthead of <site> is client relevance, not session, so it will not really work in our RESTAPI use case.

If we were on the client, we could do something like this
q: concatenation "%0d%0a" of lines of mastheads of sites whose (name of it = "actionsite")

Are you talking External Site mastheads, or are you talking Custom Sites (your use case suggests you are talking Custom Sites)

Both actually. But there are sites my Production server is subscribed to that don’t appear to be available in the list, so having the masthead would be helpful.

I suppose I can just manually use the QNA tool to export all the mastheads so I can save them as files.

As for the Custom Sites, if they don’t exist on Test, put do on Prod, I’ll just create them and then get the contents from Production.

I’m using this exercise as an excuse to learn Python programming and to get a better handle on what the RestAPI can do for it at this point. If there are things it can’t do, then I’ll happily resort to manual processes but if I can automate it, I’d like to try.

Can WebUI Query be accessed via RestUI?

Yes, it can. Using the /api/clientquery resource…

https://developer.bigfix.com/rest-api/api/bigfix_query.html

What language are you using? There are some examples at developer.bigfix.com ; additionally I think I could provide some in Python or PowerShell.

I’m doing all this in Python at this point.

It’s sort of an excuse to learn the Python Syntax and Language and to try and minimize the amount of “Manual Labor” I have to engage in every quarter when they let me upgrade the BigFix environment.

I’m thinking that the Relays might be good systems to query for the Mastheads since I believe they get subscribed to all the sites don’t they?

I will be monitoring this. May be valuable to keep my QA environment in sync with Prod for enabled features.
Though I would likely do this in PowerShell since currently my team is Windows based.