Select to view content in your preferred language

How to get Utility network error IDs via REST APIs or SDK ?

390
5
Jump to solution
05-04-2025 07:42 PM
DungChu
Emerging Contributor

Read the document: https://pro.arcgis.com/en/pro-app/latest/help/data/utility-network/about-error-features.htm#ESRI_SEC.... This table shows the details of error codes in Dirty Areas layer. How can I get this information via REST APIs or SDK ?

DungChu_1-1746376680107.png

0 Kudos
1 Solution

Accepted Solutions
gis_KIWI4
Frequent Contributor

@DungChu - You will need to resolve the error message post. I am unaware of a method to get the resolved error message directly from the REST endpoint. 

Even the pop-up in ArcGIS Pro uses an arcade expression to resolve them.

var code = $feature.ERRORCODE;

if (code == 0) {
    return;
}

var unknown = 'See the online help for this error';

var static_messages = [
    "0: The field has invalid data type.",
    "1: The geometry for the network feature is empty.",
    "2: Getting subtype value fails or the subtype value is unknown.",
    "3: Getting subtype discriminator value fails or the subtype discriminator value is unknown.",
    "4: Line feature has fewer than two vertices.",
    "5: Line feature has length within tolerance.",
    "6: Geometry error could not locate the vertex along the line feature.",
    "7: Standalone point feature.",
    "8: Invalid connectivity - No junction edge rule.",
    "9: Invalid connectivity - More than one junction edge rule applicable.",
    "10: Invalid connectivity - The edges are different subtypes and cannot connect.",
    "11: An end of an edge has a missing junction.",
    "12: " + unknown,
    "13: Invalid connectivity - Edge Connectivity Policy for feature or object does not support AnyVertex.",
    "14: " + unknown,
    "15: " + unknown,
    "16: " + unknown,
    "17: No containment rule.",
    "18: No structural attachment rule.",
    "19: Multipart line encountered.",
    "20: Self-intersecting line.",
    "21: Duplicate vertices.",
    "22: " + unknown,
    "23: The subtype or the discriminator are out of range or the combination is invalid.",
    "24: Invalid line feature was discovered during updating subnetwork.",
    "25: Stacked point features.",
    "26: Invalid device feature was discovered during updating subnetwork.",
    "27: Invalid parent subnetwork discovered during update subnetwork.",
    "28: Disjoint subnetwork discovered during update subnetwork.",
    "29: Inconsistent subnetwork name on multiple subnetwork controllers in the same subnetwork discovered during update subnetwork.",
    "30: Inconsistent subnetwork name on multiple parent subnetwork controllers in the same subnetwork discovered during update subnetwork.",
    "31: Association record is referencing an invalid from or to globalid.",
    "32: Error setting weight values.",
    "33: Inconsistent asset group or asset type of subnetwork controller discovered during update subnetwork.",
    "34: Feature or object in unsupported containment relationship.",
    "35: Feature or object in unsupported structural attachment relationship.",
    "36: Line feature has invalid terminal.",
    "37: A feature with the Subnetwork Tap category must be coincident with one midspan vertex.",
    "38: Devices with multiple terminals cannot be midspan.",
    "39: Point feature has invalid terminal configuration.",
    "40: Invalid junction feature was discovered during updating subnetwork.",
    "41: Invalid junction object was discovered during updating subnetwork.",
    "42: Invalid edge object was discovered during updating subnetwork.",
    "43: " + unknown,
    "44: " + unknown,
    "45: " + unknown,
    "46: " + unknown,
    "47: Invalid subnetwork connectivity, multiple controllers from different tiers found during updating subnetwork.",
    "48: " + unknown,
    "49: " + unknown,
    "50: " + unknown,
    "51: " + unknown,
    "52: " + unknown,
    "53: " + unknown,
    "54: " + unknown,
    "55: " + unknown,
    "56: " + unknown,
    "57: " + unknown,
    "58: " + unknown,
    "59: " + unknown,
    "60: " + unknown,
    "61: " + unknown,
    "62: " + unknown,
    "63: " + unknown
];

var errors = [];
var bitMask = 1;
var i = 0;

for (var j = 0; j < 64; j++) {
    if ((code & bitMask) > 0) {
        errors[i++] = static_messages[j];
    }
    bitMask = bitMask * 2;
    if (bitMask > code) {
        break;
    }
}

return Concatenate(errors, '<BR>');


If you are open to using arcpy - you could resolve the message using the above logic or lookup table of "if...then" statements.

The other way is to "Summarize Utility Network Errors" in UDMS toolbox. You can run this on a service.
The results contains the resolved error message. 


View solution in original post

5 Replies
gis_KIWI4
Frequent Contributor

@DungChu - You can query the DirtyArea layer using the REST API. 
You will need the layer ID that you can find using ArcGIS REST services directory. 

gis_KIWI4_1-1746417206656.png

 

You can then use the query operation via REST.

gis_KIWI4_0-1746417128041.png

You will be interested in the "ERRORMESSGAE" field which you will have to resolve to find out more details of what the reason for the dirty area is.

The results - 

gis_KIWI4_2-1746417430259.png

 

0 Kudos
DungChu
Emerging Contributor

@gis_KIWI4 Thanks for your answer. The "ERRORMESSAGE" field only shows error number codes (e.g., 9, 25), making it unclear what they mean. I need information that maps these codes to their actual error messages via call an API or SDK. 

0 Kudos
gis_KIWI4
Frequent Contributor

@DungChu - You will need to resolve the error message post. I am unaware of a method to get the resolved error message directly from the REST endpoint. 

Even the pop-up in ArcGIS Pro uses an arcade expression to resolve them.

var code = $feature.ERRORCODE;

if (code == 0) {
    return;
}

var unknown = 'See the online help for this error';

var static_messages = [
    "0: The field has invalid data type.",
    "1: The geometry for the network feature is empty.",
    "2: Getting subtype value fails or the subtype value is unknown.",
    "3: Getting subtype discriminator value fails or the subtype discriminator value is unknown.",
    "4: Line feature has fewer than two vertices.",
    "5: Line feature has length within tolerance.",
    "6: Geometry error could not locate the vertex along the line feature.",
    "7: Standalone point feature.",
    "8: Invalid connectivity - No junction edge rule.",
    "9: Invalid connectivity - More than one junction edge rule applicable.",
    "10: Invalid connectivity - The edges are different subtypes and cannot connect.",
    "11: An end of an edge has a missing junction.",
    "12: " + unknown,
    "13: Invalid connectivity - Edge Connectivity Policy for feature or object does not support AnyVertex.",
    "14: " + unknown,
    "15: " + unknown,
    "16: " + unknown,
    "17: No containment rule.",
    "18: No structural attachment rule.",
    "19: Multipart line encountered.",
    "20: Self-intersecting line.",
    "21: Duplicate vertices.",
    "22: " + unknown,
    "23: The subtype or the discriminator are out of range or the combination is invalid.",
    "24: Invalid line feature was discovered during updating subnetwork.",
    "25: Stacked point features.",
    "26: Invalid device feature was discovered during updating subnetwork.",
    "27: Invalid parent subnetwork discovered during update subnetwork.",
    "28: Disjoint subnetwork discovered during update subnetwork.",
    "29: Inconsistent subnetwork name on multiple subnetwork controllers in the same subnetwork discovered during update subnetwork.",
    "30: Inconsistent subnetwork name on multiple parent subnetwork controllers in the same subnetwork discovered during update subnetwork.",
    "31: Association record is referencing an invalid from or to globalid.",
    "32: Error setting weight values.",
    "33: Inconsistent asset group or asset type of subnetwork controller discovered during update subnetwork.",
    "34: Feature or object in unsupported containment relationship.",
    "35: Feature or object in unsupported structural attachment relationship.",
    "36: Line feature has invalid terminal.",
    "37: A feature with the Subnetwork Tap category must be coincident with one midspan vertex.",
    "38: Devices with multiple terminals cannot be midspan.",
    "39: Point feature has invalid terminal configuration.",
    "40: Invalid junction feature was discovered during updating subnetwork.",
    "41: Invalid junction object was discovered during updating subnetwork.",
    "42: Invalid edge object was discovered during updating subnetwork.",
    "43: " + unknown,
    "44: " + unknown,
    "45: " + unknown,
    "46: " + unknown,
    "47: Invalid subnetwork connectivity, multiple controllers from different tiers found during updating subnetwork.",
    "48: " + unknown,
    "49: " + unknown,
    "50: " + unknown,
    "51: " + unknown,
    "52: " + unknown,
    "53: " + unknown,
    "54: " + unknown,
    "55: " + unknown,
    "56: " + unknown,
    "57: " + unknown,
    "58: " + unknown,
    "59: " + unknown,
    "60: " + unknown,
    "61: " + unknown,
    "62: " + unknown,
    "63: " + unknown
];

var errors = [];
var bitMask = 1;
var i = 0;

for (var j = 0; j < 64; j++) {
    if ((code & bitMask) > 0) {
        errors[i++] = static_messages[j];
    }
    bitMask = bitMask * 2;
    if (bitMask > code) {
        break;
    }
}

return Concatenate(errors, '<BR>');


If you are open to using arcpy - you could resolve the message using the above logic or lookup table of "if...then" statements.

The other way is to "Summarize Utility Network Errors" in UDMS toolbox. You can run this on a service.
The results contains the resolved error message. 


DungChu
Emerging Contributor

@gis_KIWI4  - Thank you, your solution is the same as my initial solution. I appreciate it 😘

0 Kudos
RobertKrisher
Esri Regular Contributor

I recommend using the approach mentioned by @gis_KIWI4 , since a given dirty area can represent multiple errors, and the tool will also look at the associations table. In addition to that, it also gives you helpful information about the asset groups/asset types of the features involved.