GET Requests using Filters - Intergraph Smart Electrical - 2.1 - Help - Intergraph

Intergraph Smart Electrical Smart API Help

Language
English (United States)
Product
Intergraph Smart Electrical
Search by Category
Help
Smart Electrical Web Version
2.1

The following requests use the $filter function. It is a powerful tool to query only what you are looking for. Below are the operators you can define with the filter function.

Operator

Description

Comment

eq

Equal

Performs an exact match on that field

ne

Not equal

Matches on non-matching values

gt

Greater than

Matches when the field is greater than the value

ge

Greater or equal

Matches when the field is greater than or equal to the value

lt

Less than

Matches when the field is less than the value

and

Logical and

or

Logical or

contains

Matches anything that contains the value

startswith

Matches on anything that starts with the value

endswith

Matches on anything that ends with the value

Filters with the 'contains', 'startswith', or 'endswith' operators do not work for properties that are select lists. To verify whether a property is a select list, run the request 02.04 Plant annotations and search for the property in the results. In the example below, the motor property 'ItemStatus' is a select list, whereas the 'Description' and 'ItemTypeName' properties are not.

Filter Item Tag (Plant Item) eq 'M-2'

In request 03.06 Specific motor, you already saw how a filter works. The following request filters for a specific plant item with item tag ‘M-2’ and additionally queries the number of plant items retrieved using the $count operator.

  • Select the request 04.01 Filter (Plant Item) eq Item Tag and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/PlantItems?$count=true&$filter=ItemTag eq 'M-2'

    The response returns a single item (Motor) with the requested item tag value.

Filter Control Stations with Note ne ''

This request gets all the control stations that include a note. The request also includes the number of items.

  1. Select the request 04.02 Filter (Control Stations) - with Note + count and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/ControlStations?$count=true&$filter=Note ne ''

    The results show the number of control stations that are returned with the requested filter.

  2. Now change the ‘ne’ parameter in the request to ‘eq’ and resend the request. Note the number of control stations returned.

  3. Next, remove the filter condition completely from the request and resend. The total number of control stations returned should be equal to the sum of control stations returned by the previous two requests.

Filter starts with

This request gets all the plant items whose Item Type Name property value starts with the string ‘Signal’. The request also includes the number of items.

  • Select the request 04.03 Filter starts with and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/PlantItems?$count=true&$filter=startswith(ItemTypeName,'Signal')

Filter ends with

This request gets all the plant items whose Item Type Name property value ends with the string ‘Run’. The request also includes the number of items.

  • Select the request 04.04 Filter ends with and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/PlantItems?$count=true&$filter=endswith(ItemTypeName,'Run')

Filter contains

This request gets all the motors whose Item Tag property value contains the string ‘123’. The request also includes the number of items and some selected properties.

  • Select the request 04.05 Filter contains and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Motors/Com.Ingr.SEL.V2.WEBAPISITE001.PLANT001.Motor/?$count=true&$select=Id,ItemTag,MotorRatedPower,RatedVoltage,aabbcc_code&$filter=contains(ItemTag,'mo')

Filter using logical or

This request gets all the control stations that contain 'CS-16' or 'TESTCS' in their name.

  • Select the request 04.06 Filter using logical OR and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Instruments/Com.Ingr.SEL.V2.WEBAPISITE001.PLANT001.ControlStation/?$count=true&$select=ItemTag,ItemTypeIdentifier,SP_CircuitID,aabbcc_code&$filter=contains(ItemTag,'CS-16') or contains(ItemTag,'TESTCS')

Motors filtered by equipment type

This request gets all the motors with a rated voltage of 230 V. The request also includes the number of items and some selected properties.

  • Select the request 04.07 Filter (Motor) eq Item EquipmentType + count + selected properties and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Motors/Com.Ingr.SEL.V2.WEBAPISITE001.PLANT001.Motor/?$count=true&$select=Id,ItemTag,MotorRatedPower,RatedVoltage,aabbcc_code&$filter=RatedVoltage eq '230 V'