BFI REST for importing into ServiceNow - need help with syntax

Greetings,

I am trying to interface with BFI via REST. Ultimately, I want to produce a full inventory of software installed on each system and parse it for importing into ServiceNow.

The problem I am having is in accessing the “hidden” fields of sam/software_instances using the “columns[]” parameter. I receive no syntax error, but I do not receive the desired fields. The data structure of interest for software_instances is

{
“id”: 123,
“software_fact_id”: 123, //hidden by default
"computer_system_id": 3,
“computer_id”: 3, //hidden by default
"discoverable_guid": “0768fb15-383c-4124-a7e2-0d76dda06874”,
“default_product_guid”: “78d380e0-9fb9-11e3-a151-005056872dc7”,//hidden by default
"first_used": null,
“last_used”: null,
“valid_from”: “2014-04-02T14:24:04Z”,
“valid_to”: “9999-12-31T23:59:59Z”,
“updated_at”: “2014-04-02T14:24:04Z”,
“signature_count”: 1,
“total_time”: 0,
“total_runs”: 0,
“avg_run_time”: null,
“avg_runs_per_day”: null,
“process”: null,
“deleted”: false, //hidden by default
"catalog_dimension": //hidden by default
{
“software_title_name”: “IBM BigFix Platform Agent”,
“publisher_name”: “IBM”,
“software_title_version_name”: “IBM BigFix Platform Agent”,
“software_title_release_name”: “IBM BigFix Platform Agent”,
“version”: “9.0”
}
}

The call I am making using CURL is, (masking hostname and token):

curl -k https://YYYYY:9081/api/sam/software_instances?token=XXXXX&columns[]=computer_id&columns[]=catalog_dimension.software_title_name&columns[]=catalog_dimension.software_title_release_name&columns[]=catalog_dimension.version

Even a simplified version for debugging yields no additional requested field:

curl -k https://YYYYY:9081/api/sam/software_instances?token=XXXXX&column[]=computer_id

I suspect I am making a ridiculously simple syntax oversight and missing it - any hints?

You structure looks correct…I’ve tried this on my BFI instance with no issues…there is one thing I did run into but my situation was related to having Compliance.

Frank,

Thanks for looking into this.

Problem solved - I was getting bit by Shell metacharacters and CURL URL globbing options.

For the Shell, the URL needed single quotes to prevent any special meaning being applied to ‘&’ or square brackets.

For CURL the -g option is needed to not glob the URL.

Winning formula:

curl -k -g ‘https://YYYY:9081/api/sam/software_instances?token=XXXX&columns[]=computer_id&columns[]=catalog_dimension.software_title_name&columns[]=catalog_dimension.software_title_release_name&columns[]=catalog_dimension.version

1 Like