Custom Report URLs

Is there a way to programmatically reverse-engineer the properties of a saved custom report? Web Reports saves the reports as XML with a “URLParameters” key, which contains what seems like some sort of hashing of the included columns/filters, but you can’t really tell what they translate to until you enter them as parameters in the URL.

For example, in my BigFix lab instance, this:
#collapseState=&reportInfo=&filterManager=ec269ec8fe2a07fbef4ce17cdcf4292adfae4abd&chartSection=&wr_computerTable=ab2292c5e183533a30e51726d883699b707e10ae

Translates to:
Filter: None Columns: Computer Name, IP Address, OS, Last Report Time

It’s not trivial to decode, and not portable across Web Reports servers. In that case is it still worthwhile to you?

There’s a table in the database where this is a key value, and the second column is a hex-encoded value for what this key stores. I built a SQL procedure to decode it, but it doesn’t really help if you want to sync across multiple WR servers - each could create conflicting key/value lookups.

That absolutely would be helpful! I’m trying to determine what our customers are reporting on, without them having to send me screenshots of their reports.

2 Likes

This will probably run quite slowly, I was searching for some very limited data when I originally wrote this and didn’t need to much worry about the efficiency, but I hope it’s helpful or that you can at least reuse pieces of this SQL query:

SELECT ReportName,Creator,CreatorName, isPublic, ReportXML, TextResult
FROM 
(
	SELECT ReportName,Creator,LoginName AS CreatorName, isPublic,ReportXML
	FROM [BESReporting].[dbo].[WEBREPORTS] 
	LEFT JOIN
	[BESReporting].[dbo].[USERS]
	ON Creator=UserID
) As Reports
INNER JOIN
(
	select * from
	(
		SELECT
			[ShortText],
			FullText,
			CONVERT(varchar(max),CAST(FullText AS varbinary(max))) AS TextResult
		FROM [BESReporting].[dbo].[SHORTENED_TEXT]
	) as TempTable
) AS MyShortText
 ON Reports.ReportXML LIKE '%' + MyShortText.ShortText + '%'

My sample report has two SHORTENED_TEXT substitutions in it - one looks like the Sort and another for the Columns Displayed. The MyShortText column can have a value like

"sort=R-Computer%20Name&dir=asc&startIndex=0&results=50&c=R-Computer%20Name&c=O-8361-34-2&c=R-IP%20Address&c=R-OS&c=R-CPU&c=R-Last%20Report%20Time"

This shows several Reserved Properties by name - like “R-Computer%20Name” is the (Reserved) Property “Computer Name”; it also uses the non-reserved property “O-8361-34-2” which would be the second property from Analysis 34 in site 8361. In Session Relevance I can look that up (in the Console Debugger or Web Reports QNA page) as

Q: (name of it, name of source analysis of it | "none", name of site of source analysis of it | "none") of bes properties whose (id of it = ( 8361, 34, 2 ))
A: Model, Hardware Information, OS Deployment and Bare Metal Imaging

I also have a second match from this Analysis showing the Columns that are displayed. The result for SHORTENED_TEXT on that one is in JSON format -

{"filterName":"","filterID":"","filterDescription":"{\"matchType\":\"all\",\"conditionList\":[{\"selectedContentTypeName\":\"Computer\",\"selectorList\":[{\"selectedOperatorName\":\"contains\",\"selectedOperatorValue\":\"Win\"}],\"selectedProperty\":{\"analysis\":null,\"type\":\"reserved\",\"id\":\"R-OS\",\"name\":\"OS\",\"displayName\":\"OS\"}},{\"selectedContentTypeName\":\"Computer\",\"selectorList\":[{\"selectedOperatorName\":\"contains\",\"selectedOperatorValue\":\"VMWare\"}],\"selectedProperty\":{\"analysis\":{\"id\":34,\"siteid\":8361,\"sitename\":\"OS Deployment and Bare Metal Imaging\",\"dbid\":2299732975,\"name\":\"Hardware Information\"},\"type\":\"analysis\",\"id\":\"O-8361-34-2\",\"name\":\"Model\",\"displayName\":\"Model (Hardware Information)\"}}]}"}

The JSON result is probably a bit easier to read because it shows both the Object ID for the property, as well as its displayName and the source analysis’ Display Name

2 Likes

This is great! Thank you! I should be able to extract the bits I need out of here to suit my purpose. Thanks so much for the detail!

2 Likes