Requests on Items and their Properties in a Project - Intergraph Smart Instrumentation - Help - Intergraph

Intergraph Smart Instrumentation Smart API Tutorial

PPMProductFamily
Engineering and Schematics
PPMProduct
Intergraph Smart Instrumentation
PPMCategory
Help
Version_WebSI
2.2

Get Instrument Collection

The following request gets the Instrument collection in the domain. The "/Instruments" navigation property is added to the request PlantGroup ('{{PlantGroupId}}'). The payload exposes the common properties including visible user defined fields and user defined tables.

  • Select the 03.01 Get Instrument Collection request and click Send.

    {{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Instruments

The number of items that is retrieved in the payload is limited to 25. 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 it in the URL bar.

PlantGroup collections include all default data (default cables, default instruments, and so forth), while project specific collections do not.

Get Instrument Collection plus count

The following request returns the total count of Instruments in the selected PlantGroup.

  • Select the 03.02 Get Instrument Collection + count request and click Send.

    {{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Instruments?$count=true

By default, items are sorted by their Id if not stated otherwise in the request.

Get Project Collection

To get only instruments related to a certain project, it is possible to specify the project first and then to navigate to the instruments of that project, but first you need to know the project Id in order to use it as a navigation property.

The following request returns the projects within the PlantGroup.

Select the 03.03 Get Projects Collection request and click Send.

{{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects

The Id has a value of 0 for the "As-Built" project.

Get As-Built Instrument Collection + count + properties

In this request we navigate to the instruments of the project, but we need to find the navigation property from the project to the Instrument. This information is found in the EDM.

Run the EDM request again (if not open already). In the top right corner of the payload section, click to open a search box and type "Project". The following screen-shot shows the available entity types you can navigate to.

Navigation Properties enables you to navigate from one entity type to another by specifying the Id of the source entity. You can concatenate multiple segments of navigation properties to extract information on an item.

Select the 03.04 Get As-Built Instrument Collection + count + properties) request and click Send.

{{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects('0')/InstrumentProject?$count=true&$select=Id,InstrumentName,InstrumentService,LoopName,InstrumentManufacturer,InstrumentModel

Each property parameter is separated by comma without spaces.

In this request we have used the $select query option to specify the properties we want to list in the payload. When you don’t specify the $select query option, all properties will be listed.

You may also notice that the payload includes an Id of the InstrumentManufacturer and the InstrumentModel. These properties are defined as SelectLists and they return the Id of the respective select list item. In order to identify and find the actual engineering data of such property you should first identify it’s select list item by looking for the property Instrument/InstrumentManufacturer in the Model Annotations (request #01.04)

SelectListId="1085" identifies the SelectList Id from which the Instrument Manufacturer Id=4071 can be found in. Later in this tutorial we will cover the Select Lists but in the meantime, you can run request 08.05 Get Specific Select List Item (Id=4071 for Select List Id =1085).

The manufacturer name is "FISHER_PORTER".

Get Instrument Collection $orderby Instrument Name (ascending order)

The following request adds the method of sorting items.

The example sorts the instruments by name in ascending order.

  • Select the 03.05 Get Instrument Collection $orderby Instrument Name and click Send.

    {{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects('0')/InstrumentProject?$orderby=InstrumentName asc&$count=true&$select=Id,InstrumentName,InstrumentService,LoopName,InstrumentManufacturer,InstrumentModel,TagClass

The first instrument in the payload:

The parameter -"asc" is not required because the default sort order is ascending.

Get Instrument collection $orderby Instrument Name (descending order)

This example sorts the instruments by name in descending order.

  • Select the 03.06 Get Instrument collection $orderby Instrument Name (descending) and click Send.

    {{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects('0')/InstrumentProject?$orderby=InstrumentName desc&$count=true&$select=Id,InstrumentName,InstrumentService,LoopName,InstrumentManufacturer,InstrumentModel,TagClass

The first instrument in the payload:

You can sort by multiple properties. An example of such a request would be:

{{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects('0')/InstrumentProject?$orderby=InstrumentNamePrefix desc,TagClass desc&$count=true&$select=Id,InstrumentName,InstrumentService,LoopName,InstrumentManufacturer,InstrumentModel,TagClass

Traversing via Navigation Properties

This request demonstrates a “drill down” from the Site > PlantGroup > As-Built project > 101-F -2212> to the FE instrument and to the instrument's process line.

The example given assumes you’re working with the demo database, since the Items' names are based on the Demo database.

  • Select the 03.07 Traversing via Navigation Properties request and click Send.

    {{baseUri}}api/si/{{versionNumber}}/Sites('{{SiteId}}')/PlantGroups('{{PlantGroupId}}')/Projects('0')/LoopProject('4292')/InstrumentLoop('4293')/InstrumentLine1st