Retrieving raw metering data

Available from 9.2.2. This API retrieves raw metering data, which contains information about the use of software items that are installed on your computers. Unlike in the UI, through this API you can retrieve all historical data that is stored in the database.

To obtain information about detected software use api/sam/v2/software_instances API.

Before you begin

Use limit parameter when previewing API output

When you use the api/sam/raw_app_usage_property_values API for test purpose, append the limit parameter to achieve faster response time. First 100 records should be sufficient to have a view on the data available.

https://hostname:port/api/sam/raw_app_usage_property_values?token=token&limit=100
Note: Each API request must be authenticated with the token parameter. You can retrieve it by using REST API for retrieving authentication token. You can also log in to BigFix Inventory, hover over the User icon , and click Profile. Then, click Show token.
Table 1. Operation descriptions

The table consists of two columns and 15 rows. For the eleventh row there are two levels.

Operation details Description
Operation GET /api/sam/raw_app_usage_property_values
Purpose Returns raw package data.
HTTP method GET
Resource URI https://server_host_name:port_number/api/sam/raw_app_usage_property_values
URL link relation n/a
URI query parameters n/a
Request headers
Header
Accept-Language (optional)
Values
en-US (only English is supported)

Used to negotiate the language of the response. If this header is not specified, the content is returned in the server language.

Request payload n/a
Request Content-Type
  • application/json
Response headers
Header
Content-Type
Values
application/json

Specifies the content type of the response.

Header
Content-Language
Values
en-US, …

Specifies the language of the response content. If this header is not specified, the content is returned in the server language.

Response payload App Usage Property Value element
Response Content-Type
  • application/json
Normal HTTP response codes
  • 200 – OK
Error HTTP response codes
  • 500 – “Bad Request” if a query parameter contains errors or is missing

Message body includes an error message with details.

Query parameters

You can use query parameters to narrow down the results of your search.
Table 2. Query parameters

The table consists of four columns and nine rows.

Parameter Description Required Value
columns[] Specify which columns to retrieve. If you do not specify this parameter, a set of default columns is retrieved. Example:
Retrieve the name and computer_id columns:
URL?columns[]=name&columns[]=computer_id
No String
order Specify how to sort the returned data. The default direction for sorting columns is ascending. If you want to specify a descending sort, append desc to the column name. Example:
Order by name descending:
URL?order[]=name desc
No String
limit Specify the number of rows to retrieve. If you omit this parameter, all rows are retrieved. For BigFix Inventory versions up to 10.0.1, if you omit the 'limit' parameter, 100 000 rows are retrieved. The number is defined at raw_data_api_default_limit on the Advanced Server Settings panel.
Note: Parameter raw_data_api_default_limit has been removed since BigFix Inventory version 10.0.2.
No Numeric
offset Specify the number of rows to skip for retrieving results. You can use it together with the limit parameter to paginate results. Example:
Retrieve 50 records starting after record 150:
URL?limit=50&offset=150
No Numeric
token A unique user authentication identifier. You can view your token in the Profile preferences of BigFix Inventory. Yes Alphanumeric
criteria Retrieve records which match specific conditions. The parameter should have the following structure, written on one line:
<criteria> ::= <left-brace> <boolean-operator><colon> <left-bracket> 
<criterion> [{ <comma> <criterion> }...] <right-bracket> <right-brace>
<boolean-operator> ::= "and" | "or"
<criterion> ::= <criteria> | <left-bracket> <column> <comma> <operator> <comma> <value> <right-bracket>
<column> ::= <json-string>
<operator> ::= <json-string>
<value> 	::= <json-array> | <json-string> | <json-numver> | <json-null>

For more information about operators, see Common connectors and operators.

Example: Retrieve metering data from computer systems with ID greater than 10:
URL?criteria={ "and": [ ["computer_id", ">", "10"]]}
For columns that use the date and time values, such as Last Seen, you can retrieve data also for a period instead of a specific date. To do so, use last or next as <operator>, and then specify the time value in the following convention: PxD/PxW/PxM/PxY, where x is a number in the 1-999 range, and D, W, M, or Y is a designator that represents days, weeks, months, or years respectively. For example, to retrieve computer systems that reported within last 7 days, use the following API request:
URL?criteria={"and":[["last_seen","last","P7D"]]}

Example HTTP conversation

Request
GET api/sam/raw_app_usage_property_values
?token=7adc3efb175e2bc0f4484bdd2efca54a8fa04623
Host: localhost:9081 
Accept: application/json 
Accept-Language: en-US
Response header
HTTP/1.1 200 OK
Content-Type: application/json
Content-Language: en-US
Response body (JSON)
 {
  "app_usage_property_id": -1,  
  "computer_id": 2,
  "process": "BESClient.exe",
  "first_used": "2015-03-27T16:28:47Z",
  "last_used": "2015-08-03T11:46:16Z",
  "total_runs": 5,
  "total_time": 10888494,
  "avg_runs_per_day": 0.03943099252280677,
  "avg_run_time": 2177698.8,
  "valid_from": "2015-08-05T14:41:19Z",
  "valid_to": "9999-12-31T23:59:59Z" 
 }
 {
  "app_usage_property_id": -1,
  "computer_id": 2,
  "process": "BESConsole.exe",
  "first_used": "2015-07-09T11:27:50Z",
  "last_used": "2015-07-13T13:33:42Z",
  "total_runs": 2,
  "total_time": 16767,
  "avg_runs_per_day": 0.4893077201884741,
  "avg_run_time": 8383.5,
  "valid_from": "2015-08-05T14:41:19Z",
  "valid_to": "9999-12-31T23:59:59Z"  
 }