Interesting and useful JSON RESTful APIs in Web Reports

I noticed post-upgrade to 9.5.8 that some of the .csv methods were a little different (borked) from prior automation. Requests we had cadged from prior XHR and console watching to make our report automation simpler were no longer quite right…

Specifically something had changed in the report generation processes affecting my applying a third and/or fourth dimension of fixlet information data to first and second dimensions of computer properties data. I had been merging it using a mongrel toolset of (curl/grep/sed/awk/cut/tr/etc,etc.) Digging into the XHR, I saw new methods in Web Reports, pretty clearly put there to support a deeper RESTful API integration and JS-ifying of the WR frontend vs the current core RESTful relevance-y XML.

If you are like me and don’t want to write a relevance for every single reporting activity that needs nice clean JSON, this may help save your sanity and/or productivity.

If you’re interested, I put together some documentation, a python script, and config file to pull some information using these APIs, located here: https://github.com/DoubleDeuceBuddha/bfwr_api

WARNING: THESE ARE UNDOCUMENTED AND LIKELY TO CHANGE

Seemingly new methods (non-exhaustive):

  1. computers
  2. fixletproperties
  3. chartdata
  4. getallfilters

All of these are accessible via http(s)://yourbfserver(:52311)/json/methodname

Useful parameters:

  • Text shorten/unshorten:
    shortentext
    unshorten

  • Pagination:
    &results=-1&startIndex=0 will give you all results
    &results=100&startIndex=300 will give you 100 results starting at the 300th result
    This script is hardcoded for all results in the build_parameters function.

  • Columns:
    &c= column/property name to include
    &sort= column/property name
    &dir= direction (asc or desc)

    Example:
    &sort=column1&sort=column2&sort=column3&dir=asc&dir=desc&dir=asc&c=column1&c=column3&c=column2&c=column4
    Will present 4 columns in this order: column1, column3, column2, column4
    Sorted on column1 ascending, column2 descending, column3 ascending, column 4 unsorted

    c=R-Computer Name is required or your query will fail

3 Likes

Hi Scott,

I was trying this from my REST client but is failing (error: connection refused…)
https://./webreports?page=ExploreComputers.

We are trying to get the web reports for Computer data instead of Server APIs. Please suggest.

It’s been over a year since I had my hands on a web reports instance to test.

It’s possible (likely) that these endpoints have changed and/or that the authe/autho method has changed.

Try watching XHR in your developer tools on your browser when you first login and also when you make a similar request in web reports as you’re trying to pull programmatically. It may help you troubleshoot the process better.

Your REST client should be directed to the root server, not to web reports. And the URLs start with https://rootserver:52311/api

Check https://developer.bigfix.com for the reference and example scripts.