Creating the “Indicators in Alarm” Query


This query is similar to “Assets” but a bit more complex. It returns indicators, their assets, and most recent readings. Readings are filtered to include those in alarm. This section explains how to set up the query. The second part explains the parameters and data in more detail.

Note: You will need the tenant name and GUID that Bentley assigned to your database, as well as Read access to the API.

To Create the “Indicators in Alarm” Query

1. In the collection you created previously (for example, “Bentley Reliability API”), create a request. Right-click the collection name and click Add Request.

The Save Request dialog opens.

2. For the Request name, enter “Indicators in Alarm”.

3. Click Save. “Indicators in Alarm” is added to the requests in the collection.

4. Select the request and enter the request URL in the GET line:

https://reliability.bentley.com/odata/MNT.Indicators?$expand=Asset($select=AssetNumber,
Title),IndicatorType($select= IndicatorTypeName), MostRecentReading($select=CombinedValueCollected,DateTimeCollected; $expand=AlarmType($select=AlarmTypeName),CollectedBy($select=EmployeeName))

5. Set the request to inherit authorization from the collection. Select the Authorization tab. Select Inherit auth from parent.

6. Select the Headers tab and add the Key (Tenant) and Value (GUID) that Bentley assigned to your database.

7. Click Send. The Body section displays the result. For example:

More About the “Indicators in Alarm” Query

This query is more complex than “Assets” in that it uses a nested expand parameter, filter, and more.

Here again is the request URL from the GET line:

https://reliability.bentley.com/odata/MNT.Indicators?$expand=Asset($select=AssetNumber,
Title), IndicatorType($select= IndicatorTypeName), MostRecentReading($select=CombinedValueCollected,DateTimeCollected;$expand=AlarmType($select=AlarmTypeName),CollectedBy($select=EmployeeName))

Not all parameters need to be included in the GET line. They can be set in the Params tab only, as shown here when the Query Params section is expanded:

Indicators?$expand=Asset($select=AssetNumber,Title), IndicatorType($select= IndicatorTypeName)

The indicator name and information about the indicator’s asset are returned (AssetNumber and Title), as well as the indicator type. For example:

MostRecentReading($select=CombinedValueCollected,DateTimeCollected;$expand=AlarmType ($select=AlarmTypeName),CollectedBy($select=EmployeeName))

For the most recent reading, the combined value collected and date and time collected are returned, as well as the alarm type and “collected by” values for the most recent reading:

$filter – HasAnAlarm eq true

Only indicator readings with unacknowledged alarms are returned.

$orderby – MostRecentReading/DateTimeCollected desc

Readings are organized according to the date and time they were collected.