GET Requests to expose Items and their Properties - Intergraph Smart Electrical - 2.1 - Help - Intergraph

Intergraph Smart Electrical Web API Help

Language
English
Product
Intergraph Smart Electrical
Subproduct
Web API
Search by Category
Help
Smart Electrical Web Version
2.1

The page size (the number of items retrieved in the payload) is set to 25 by default. A link at the bottom of the payload provides access to the next 25 items, including all their related properties. To view the next 25 items, scroll down to the bottom of the payload to find a link and then copy and paste the link into the URL address bar. The example provided here is based on our tutorial environment:

https://apiservername.domain.com/WebApi/SEL/V2/Sites%28%27WEBAPISITE001%27%29/Plants%28%27PLANT001%27%29/Motors?%24skip=25

From Smart Electrical Web API 2.1.3, the page size can be changed to a different value (up to a maximum of 1000) per request by specifying odata.maxpagesize in the request's parameters or as a header, for example, to change the page size to 30 for motors, do one of the following:

  • Add header Prefer=odata.maxpagesize=30 and run the request:

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Motors

  • Include the required odata.maxpagesize value in the request:

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Motors?$odata.maxpagesize=30

If odata.maxpagesize is set to more than the maximum allowed value of 1000, from Smart Electrical Web API 2.1.4, the software sets the page size to 1000 (in 2.1.3, it reverted to the default value of 25).

Motors

The following request runs on motors in a plant. "/Motors" is added to the request after the plant Id, in this case "PLANT001". The payload exposes only common properties.

  • Select the request 03.01 Motors and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Motors

Motors plus count

The following request includes the total count of motors in the payload.

  • Select the request 03.02 Motors + count and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Motors?$count=true

    Use $count=true when dealing with data. This lets the service know how many items are needed to report and avoids the need for an unnecessary link to the next page. The count appears at the beginning of the payload and is shown highlighted:

    The count shows the total number of items in the entire payload and not just on the current page of the response.

Motors plus count plus selected properties

The following request is built on the previous one, with additional parameters for selected properties.

  • Select the request 03.03 Motors + 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

    • When selected properties appear in the request, you must include the namespace containing the specific site, plant, and item type:

      /Com.Ingr.SEL.V2.WEBAPISITE001.PLANT001.Motor

      This is necessary because the properties are defined at the level of the plant metadata.

    • Any invalid characters in site or plant names such as space, colon, backslash, are replaced by a double underscore (__) in the namespace.

    • For selection of more than one property, each property parameter is separated by a comma, without spaces.

    SHARED Tip For your convenience in this tutorial, the namespace variables {{Namespace Site}} and {{Namespace Plant}} are included in the environment and in the requests.

Motors ordered by item tag in ascending order plus selected properties

The following request adds the method of sorting items by their item tags in ascending order.

  • Select the request 03.04 Motors + order by Item Tag Asc + selected properties and click Send.

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

Motors ordered by item tag in descending order plus selected properties

The following request adds the method of sorting items by their item tags in descending order.

  • Select the request 03.05 Motors + order by Item Tag Desc + selected properties and click Send.

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

In the above requests, we used the entity type ‘Motor’. There are other collections of entity types in the plant. Those collections are exposed in the request 02.02 Common metadata. In the response, search for the string: ‘EntityType Name=Plant’ to reveal a list of all the navigation properties of the plant.

Specific motor

The following request retrieves a specific motor based on its item tag using the $filter function. In the example below, the filter is used to find a motor with an Item Tag value = ‘M-2’.

  • Select the request 03.06 Specific motor and click Send.

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

    This filter retrieves the motor with all its properties. For details of other ways in which the $filter function can be used, see GET Requests using Filters.

Specific motor + selected properties

The following request is built on the previous one, with additional parameters for selected properties.

  • Select the 03.07 Specific motor + selected properties request and click Send.

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

Specific motor + expand cable side 2

This request retrieves all the properties of a specified entity (motor) and of the instances of an associated entity type (cables). For this purpose, the $expand function for the entity is used in the request. In this request, you will specify the motor by entering its Id as discovered in the previous request.

  • Select the 03.08 Specific motor + expand cable side 2 request and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Motors('0584D3F3D20F4EF0BDCC11C943994F7C2')?$expand=CableSide2s

    In the payload, search for the string: ‘PLANT001.Cable’. The number of occurrences of this string corresponds to the number of cables attached on side 2 of the specified motor.

Cables + count + selected properties for specific motor

This request uses the same motor Id as the previous request and a similar syntax to the request 03.03 Motors + count + selected properties to count the number of cables and display selected properties of those cables. Unlike the previous request, the $expand function is not used and so the properties of the motor are not shown in the payload.

  • Select the 03.09 Cables + count + selected properties for specific motor and click Send.

    https://apiservername.domain.com/WebApi/SEL/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Motors('0584D3F3D20F4EF0BDCC11C943994F7C')/Cables/Com.Ingr.SEL.V2.WEBAPISITE001.PLANT001.Cable/?$count=true&$select=Id,ItemTag,ItemTypeIdentifier,SP_CircuitID,aabbcc_code