The following requests retrieve information about the hierarchy of Smart P&ID's Sites, Plants, and Engineering Projects.
Reserved words are defined in Smart P&ID Web API for certain entities such as hierarchy items (site, plant, project) and item
types such as piperun and equipment. When creating a custom hierarchy in Smart Engineering Manager, plant group names using these reserved words are allowed. From Version 2.07, Smart P&ID Web API handles custom hierarchies as follows:
-
The plant group at the root level of a plant structure is always named 'Plant'.
-
Plant groups that use reserved words are assigned the suffix 'PlantGroup'; for example, 'Plant' is renamed as 'PlantPlantGroup', 'Instrument' is renamed as 'InstrumentPlantGroup', and so forth.
-
The DisplayName property in the Annotations of an entity using a reserved word as the name has the same name (without the 'PlantGroup' suffix) as the original name entered in Smart Engineering Manager.
The following request example includes the use of reserved words 'Instrument', 'Site' and 'Plant' for plant group names and shows how the 'PlantGroup' string is appended to the collection names before the final 's':
{{baseUri}}/SPID/V2/Sites('Site')/Plants('Plant')/Com.Ingr.SPID.V2.Site.Plant.Plant/
Projectss('Project2')/InstrumentPlantGroups('Instrument')/Instrumentss('Instruments')/
Reports('Report')/Filess('Files')/SitePlantGroups('Site')/PlantPlantGroups('Plant')/
Areas('Area1')/Units('Unit1')
Root - a request for exposing the Smart API root
The first request queries the root level based on Smart P&ID's schema, with "/V2" at the end of the syntax, representing the release version of the Smart API.
-
Select the request 02.05 Root and click Send.
https://apiservername.domain.com/WebApi/SPID/V2
The response retrieves a single EntitySet called: "Sites", which includes a navigation property of "Sites":
Sites
By looking at the previous response, you can navigate to the sites. The next pre-configured request is built on the previous request, requesting to retrieve a collection of Sites.
-
Select the request 02.06 Sites and click Send.
https://apiservername.domain.com/WebApi/SPID/V2/Sites
The response in our example shows a single site with its ID and name: "WEBAPISITE001".
Specific site
Based on the above request, you can now retrieve a specific site.
-
Select the request 02.07 Specific site and click Send.
https://apiservername.domain.com/WebApi/SPID/V2/Sites('WEBAPISITE001')
The response shows the site ID and name:
Plants
To retrieve the plants under the site, do the following:
-
Select the request 02.08 Plants and click Send.
https://apiservername.domain.com/WebApi/SPID/V2/Sites('WEBAPISITE001')/Plants
The response shows the IDs and names of all the plants in the site:
Specific plant
-
Select the request 02.09 Specific plant and click Send.
https://apiservername.domain.com/WebApi/SPID/V2/Sites('WEBAPISITE001')/Plants('PLANT001')
The response shows the specific plant ID and name:
Engineering projects
This request reveals the list of engineering projects under a specific plant. The engineering projects are partitioned to reflect each project. Each plant is an entity container at the root level. The items under the root need to contain the root node in their path, which is represented as a navigation property. Using an XML editor, you can search the string EntityType Name="Plant" in the response for request 02.02 Common metadata to find all the navigation properties of the plant.
-
Select the request 02.10 Engineering Projects and click Send.
https://apiservername.domain.com/WebApi/SPID/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Projects
Specific engineering project
This request reveals a specific engineering project, 'As-Built'.
-
Select the request 02.11 Specific engineering project and click Send.
https://apiservername.domain.com/WebApi/SPID/V2/Sites('WEBAPISITE001')/Plants('PLANT001')/Projects('As-Built')
The response returns the 'As-Built' project's Id and Name.