Appendix—Work with the utility network using the feature service

When working with the utility network through the REST API, it is important to consider the ability to access system tables that are exposed through the feature service as layers.

The layer IDs associated with these layers can be identified either through the utility network layer definition or via the associated portal item. In the JSON layer definition, they are grouped under the collection of system layers. The layer IDs that are associated with each of these layers can be used to access that table through the various feature service operations (for example, query and applyEdits).

Using the layerId of the system layer, the following are a few examples of tasks that can be completed using these layers:

  1. Work with associations.
    1. Use the query operation to inspect associations.
    2. Use the applyEdits operation to add, update, and delete associations.
  2. Use the query operation to inspect subnetworks.
  3. User the query operation to inspect network rules.

To add or update an association, the following fields must be specified in the call to applyEdits:

"ASSOCIATIONTYPE" : <1|2|3>, // connectivity, containment, attachment
"ISCONTENTVISIBLE" : <0|1>,  // optional: false, true
"FROMNETWORKSOURCEID" : <networkSourceId>,
"FROMGLOBALID" : <guid>,
"FROMTERMINALID" : <long>,   // optional
"TONETWORKSOURCEID" : <networkSourceId>,
"TOGLOBALID" : <guid>,
"TOTERMINALID" : <long>      // optional

Access the systemLayers for a utility network

To access the systemLayers for a utility network, complete the following steps:

Steps:
  1. Use the Esri JSON object output for the feature server that includes the utility network layer. You can format the JSON object using pjson in the URL:

    https://myserver.esri.com/server/rest/services/LandUse/FeatureServer?f=pjson

    Find the utilityNetworkLayerId in the pjson.

  2. Use the utility network LayerId and the Esri JSON object output for the feature server. You can format the JSON object using pjson in the URL:

    https://myserver.esri.com/server/rest/services/LandUse/FeatureServer/17?f=pjson

    Find the systemLayers to identify the LayerId for the layer of interest.

  3. Use the specific layerId to append to the end of the feature server to access the layer. From here you can access the operations for the layer:

    https://myserver.esri.com/server/rest/services/LandUse/FeatureServer/500001/query

The following is an example of the systemLayers for a Utility Network Version 4 (using the "layer name" : layer id syntax):

"systemLayers": {
  "dirtyAreasLayerId": 12,
  "lineErrorsLayerId": -1,
  "pointErrorsLayerId": -1,
  “polygonErrorsLayerId”: -1,
  "associationsTableId": 500001,
  "subnetworksTableId": 500002,
  "rulesTableId": 500003,
  "diagramEdgeLayerId": 500005,
  "diagramJunctionLayerId": 500006,
  "diagramContainerLayerId": 500007,
  "temporaryDiagramEdgeLayerId": 500008,
  "temporaryDiagramJunctionLayerId": 500009,
  "temporaryDiagramContainerLayerId": 500010
}

The following is an example of the systemLayers for a Utility Network Version 3 and earlier (using the "layer name" : layer id syntax):

"systemLayers": {
  "dirtyAreasLayerId": 12,
  "lineErrorsLayerId": 10,
  "pointErrorsLayerId": 9,
  “polygonErrorsLayerId”: 11,
  "associationsTableId": 500001,
  "subnetworksTableId": 500002,
  "rulesTableId": 500003,
  "diagramEdgeLayerId": 500005,
  "diagramJunctionLayerId": 500006,
  "diagramContainerLayerId": 500007,
  "temporaryDiagramEdgeLayerId": 500008,
  "temporaryDiagramJunctionLayerId": 500009,
  "temporaryDiagramContainerLayerId": 500010
}