Analyze Device Inventory with REST API

Use DEVICE_INVENTORY to view all monitored devices which have the Aternity Agent locally deployed, and which reported data to Aternity over the past seven days, so you can keep an updated inventory of devices and their attributes.

Using this API, you can examine the list in ways not available in the Device Inventory dashboard. For example, you can create a list of all Windows 7 devices in your organization which have the most recent service pack.

Each entry from DEVICE_INVENTORY refers to a single monitored device, and provides details about that device.

Note

You can access data using this API (retention) going back exactly a full seven days.

Before You Begin

To send a REST API query in Excel, PowerBI or a browser, enter an Aternity username which has the OData Role privilege, and its password. For SSO users, generate your own Aternity REST API password by selecting User icon > REST API Password. For LDAP users, enter the domain name, then a backslash ('\'), then your network username and password. For example domain_name\jsmith

To view an Aternity REST API, enter the URL: <base_url>/API_NAME from a browser, Excel or PowerBI (learn more). The <base_URL> is configured in the Aternity REST API Server as the external_url (learn more):

http://odata-aternity.company.com:80/aternity.odata/API_NAME
Tip

Wherever possible, use $select and $filter to narrow your query, to avoid receiving an error like Returned data is too large. Learn more.

Examples

To access this API from a browser, Excel or Power BI (learn more), enter <base_url>/DEVICE_INVENTORY

To list all the model numbers of Lenovo laptops in the Miami Sales department, enter:

.../DEVICE_INVENTORY?$select=DEVICE_MODEL&$filter=DEVICE_MANUFACTURER eq 'Lenovo' and DEVICE_TYPE eq 'Laptop' and (CITY eq 'Miami' and DEPARTMENT eq 'Sales')

To list the hostnames and location of all Mac laptops with less than 8GB RAM, enter:

.../DEVICE_INVENTORY?$select=DEVICE_NAME,DEVICE_MODEL,DEVICE_MEMORY,CITY&$filter=DEVICE_MANUFACTURER eq 'Apple' and DEVICE_TYPE eq 'Laptop' and (DEVICE_MEMORY eq '8GB' or DEVICE_MEMORY eq '4GB' or DEVICE_MEMORY eq '2GB')

To list all Windows 7 devices and their location in your organization which have Aternity Agent version 9.2.x, enter:

.../DEVICE_INVENTORY?$select=DEVICE_NAME,CITY,AGENT_VERSION&$filter=contains(AGENT_VERSION,'9.2')

For example, to retrieve the inventory of devices located in Miami's Sales Department and Los Angeles' Marketing department, use: .../DEVICE_INVENTORY?$filter=(CITY eq 'Miami' and DEPARTMENT eq 'Sales') or (CITY eq 'Los Angeles' and DEPARTMENT eq 'Marketing')&...

Supported Parameters

You can view the data by entering the URL into Excel, into a browser, or into or any OData compatible application such as Power BI.

You can add parameters to the URL to filter the returned data, by adding a question mark (?) followed by a parameter and value, such as .../aternity.odata/API_NAME?$filter=(USERNAME eq 'jsmith@company.com'), or several parameter-value pairs each separated by an ampersand (&), like .../aternity.odata/API_NAME?$format=xml&$top=5.

Parameter Description
$filter=

Use $filter to insert conditions which narrow down the data, to return only entries where those conditions are true. .

Combine several parameters using and, or, eq (equals) gt (greater than), ge (greater than or equal), lt (less than), le (less than or equal), ge (greater than or equal to), ne (not equal to) and le (less than or equal to). You can also use the text operator contains, though it significantly slows the API performance.

Aternity also supports the not operator, which negates the query expression that follows it. For example, .../aternity.odata/API_NAME?$filter=(CLIENT_DEVICE_TYPE eq 'Laptop' or CLIENT_DEVICE_TYPE eq 'Tablet') and not(LOCATION_CITY eq 'Miami' or LOCATION_CITY eq 'Los Angeles') will return data for laptops and tablets for all locations except Miami and Los Angeles. For details on these OData parameters that are supported by Aternity, see Microsoft's OData documentation.

Use the relative_time() filter to easily limit the timeframe of your query. For example, .../aternity.odata/API_NAME?$filter=relative_time(yesterday). Possible values are:

  • last_6_hours: Shows data starting from exactly six hours ago, displaying it summarized (aggregated) according to the view you selected.

  • last_24_hours: Shows data starting exactly this time yesterday, displaying it summarized (aggregated) according to the view you selected.

  • today: Displays data starting from 00:00AM today in the time zone of the Aternity Management Server.

  • yesterday: Displays data starting from 00:00AM yesterday according to the time zone of the Aternity Management Server.

  • last_48_hours: Displays data starting exactly this time two days ago, displaying it summarized (aggregated) according to the view you selected.

  • last_7_days: Displays data starting from 00:00AM seven days ago in the time zone of the Aternity Management Server.

  • this_week: Displays data for this week, beginning from 00:00 AM on Sunday morning according to the time zone of the Aternity Management Server, until the current time.

  • last_week: Displays data from 00:00AM on Sunday morning to 23:59 on the most recent Saturday night according to the time zone of the Aternity Management Server. Use this view to compare consistent weekly results.

  • last_14_days: Displays data from exactly this time 14 days ago, displaying it summarized (aggregated) according to the view you selected.

  • last_30_days: Displays data from exactly this time 30 days ago, displaying it summarized (aggregated) according to the view you selected.

$format=

Use $format to force the returned data to be either in XML or JSON format. This is only useful for programmers or those testing the raw data in a web browser. For example:

.../aternity.odata/API_NAME?$format=xml

$orderby

Use $orderby to order the returned data according to the value you choose. For example, to order results device inventory results based on location, use .../aternity.odata/DEVICE_INVENTORY?$orderby=LOCATION

$select=

Use $select to return only the data of specific columns (attributes). To return several columns, list them separated by a comma (no space).

For example, to return only the application and department, use:

.../aternity.odata/API_NAME?$select=APPLICATION,DEPARTMENT&...

$top=

Use $top (lower case only, not TOP) when you are initially testing the response of the API by returning the first few entries.

For example, to return the first five entries (not sorted in any way), use:

.../aternity.odata/API_NAME?$top=5

Tip

Wherever possible, use $select and $filter to narrow your query, to avoid receiving an error like Returned data is too large. Learn more.

Output

Each entry from DEVICE_INVENTORY refers to a single monitored device, and provides details about that device.

You can access data using this API (retention) going back up to seven days, not less or more.

Sample output from this API

The returned columns are:

Type Returned columns

Measurements

None

Attributes

Account_ID,Account_Name,Agent_Current_Status,Agent_Version,City,Country,Department, Device_CPU_Cores,Device_CPU_Frequency,Device_CPU_Generation,Device_CPU_Model,Device_CPU_Type,Device_Manufacturer,Device_Memory, Device_Model,Device_Name,Device_Type,Enforce_Privacy,IP_Address,Last_Reporting_Datetime,Location, Mobile_Carrier,Mobile_Device_ID,MS_Office_Version,On_Site,On_VPN,OS_Architecture,OS_Disk_Type,OS_FamilyOS_Name,OS_Version,Region,State,Subnet,Username,Virtual_App_Server_Edition,Virtual_App_Server_Farm,Virtual_App_Server_Version,Virtual_App_Server_Zone