Write Errors

URL:
https://<root>/<serviceName>/ValidationServer/writeErrors
Methods:
POST
Version Introduced:
11.3

Description

The writeErrors operation writes an error result or a missing feature result to the GDB_Validation*Errors tables using the specified version and session ID. The supported category parameter values are featureErrors or missingFeatureErrors. The function will return the number of new errors written, along with the moment. Any other parameter values will result in a not supported operation and generate a JSON error response.

Learn more about enabling visual review for branch versions

Request parameters

ParameterDetails

f

The response format. The default format is html.


Values: html | json | pjson

category (Required)

The featureErrors category parameter writes errors for features in a layer similar to the Browse Features visual review tool. The missingFeatureErrors category parameter writes point errors for missing features in a layer, similar to the Flag Missing Features visual review tool.



Values: featureErrors | missingFeatureErrors

gdbVersion (Optional)

This parameter specifies the geodatabase version to apply edits and only applies them if the isDataVersioned property of the layer is true. The default version for the gdbVersion parameter is DEFAULT.

Use dark colors for code blocksCopy
1
Syntax: `gdbVersion=<version>`
Use dark colors for code blocksCopy
1
Example: gdbVersion=SDE.DEFAULT

sessionID (Optional)

This parameter represents the token (guid) used to lock the version. If the calling client edits a named version, the sessionId must be provided. If the client edits DEFAULT, the version may not be locked and the sessionId should not be specified.

Use dark colors for code blocksCopy
1
Example: sessionID={E81C2E2D-C6A7-40CB-BF61-FB499E53DD1D}

errors (Required)

This parameter represents a JSON array of layers and errors to add to the appropriate validation error table (GDB_ValidationPointErrors, GDB_ValidationPolygonErrors, or GDB_ValidationLineErrors), depending on the geometry type of the source layer.

The following is a list of acceptable values:

  • id —This required property represents the id of the layer.

  • errorFeatures —This required property represents a JSON array of errors for the specified layer.

  • errorType —This required property represents the error type that best describes the errors in your data.

  • geometries —This is a required property when the category parameter is set as missingFeatureErrors to indicate the location of missing features. This is an array of geometry that corresponds to the specified layer.
  • objectIds —This is a required property when the category parameter is set as featureErrors to specify the features that will be identified as errors. This is an array of feature object IDs from the specified layer.

  • errorMessage —This optional property represents the error description of the errors for the specified layer and error type. If the user does not specify any value, the default description is the error type's string.

  • severity —This optional property represents the severity of errors for the specified layer and error type. When a number is entered that is outside the expected range of 1 to 5, the default severity value 3 is used.

Syntax:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
errors=[
    {
        "id" : <layerId1>,
        "errorFeatures" :
         [
           {
            "errorType" : <value>,
            "geometries" : [<geometry>],
            "objectIds" : [<objectId>],
            "errorMessage" : <value>,
            "severity" : <value>
           }
         ]

    },

    {
        "id" : <layerId2>,
        "errorFeatures" :
         [
           {
            "errorType" : <value>,
            "geometries" : [<geometry>],
            "objectIds" : [<objectId>],
            "errorMessage" : <value>,
            "severity" : <value>
           }
         ]
    }

]

returnEdits (Optional)

This Boolean property specifies whether to return modified features. Returned results are organized in a layer-by-layer fashion. If returnEdits is set to true, then each layer may have edited features returned in an editedFeatures object.

The editedFeatures object returns full features including the original features prior to delete; the original and current features for updates; and the current rows for inserts, which may contain implicit changes. For example, as a result of a calculation rule.

If the count of edited features to return is more than the maxRecordCount value the response will not include editedFeatures values and exceededTransferLimit will return as true. If clients are using this parameter to maintain a cache, they should invalidate the cache when exceedTransferLimit is returned as true. If the server encounters an error when generating the list of edits in the response, exceedTransferLimit is also returned as true.

Edited features are returned in the spatial reference of the feature service as defined by the services spatialReferenceObject or by the spatialReference of the layer's extent object.

The default value for this parameter is false.

Values: true | false

Example usage

Example one: featureErrors

The following is an example of the featureErrors operation. This example demonstrates writing ArcGIS Data Reviewer visual review errors into an error store on a feature service with the sample input.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
category = featureErrors
gdbVersion = GISADMIN.name
sessionId = {6F545D22-8689-4836-B22F-4DF867019DEE}
errors=
[
    {
        "id":1,
        "errorFeatures":[
            {
                "errorType": "addFeature",
                "objectIds":[1,2],
                "errorMessage":"Add Feature",
                "severity":4
            },
            {
                "errorType": "deleteFeature",
                "objectIds":[3,4],
                "errorMessage":"Custom error message here",
            }
        ]
    }
        {
        "id":2,
        "errorFeatures":[
            {
                "errorType": "moveFeature",
                "objectIds":[15,16],
                "errorMessage":"Move Feature",
                "severity":2
            }
        ]
    }
]
returnEdits = false
f = html

JSON examples

Example one: featureErrors

The following is a sample POST request for the writeErrors operation when the category is set to featureErrors.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
[
    {
        "id": 0,
        "errorFeatures":[
            {
                "errorType": "addFeature",
                "objectIds": [1, 2],
                "errorMessage": "Add Feature",
                "severity": 3
            },
            {
                "errorType": "deleteFeature",
                "objectIds": [3,4,5],
                "errorMessage": "Delete Feature",
                "severity": 2
            },
            {
                "errorType": "moveFeature",
                "objectIds": [6,7],
                "errorMessage": "Move Feature",
                "severity": 3
            },
            {
                "errorType": "reshapeLine",
                "objectIds": [8],
                "errorMessage": "Reshape Line",
                "severity": 5
            },
            {
                "errorType": "reshapeArea",
                "objectIds": [9,10],
                "errorMessage": "Reshape Area",
                "severity": 5
            },
            {
                "errorType": "changeSubtype",
                "objectIds": [11,12,13],
                "errorMessage": "Change Subtype",
                "severity": 3
            },
    },
    {
        "id": 1,
        "errorFeatures":[
            {
                "errorType": "addFeature",
                "objectIds": [40, 41],
                "errorMessage": "Add Feature",
                "severity": 3
            }
        ]
    }
]

Example two: missingFeatureErrors

The following is a sample POST request for the writeErrors operation when the category is set to missingFeatureErrors.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[
   {
      "id":0,
      "errorFeatures":[
         {
            "errorType":"missingFeature",
            "geometries":[{"x":-143.501, "y":57.043}, {"x":-72.865, "y":-37.486}],
            "errorMessage":"Missing Feature",
            "severity":1
         }
      ]
   },
   {
      "id":1,
      "errorFeatures":[
         {
            "errorType":"missingFeature",
            "geometries" : [{"x":-118.152, "y":33.801}],
            "errorMessage" : "Custom Error Message",
            "severity" : 5
         }
      ]
   }
]

JSON Response Examples

Example one:

The following is a sample response returned when returnEdits is set as false (default).

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
 "moment": 1708549937244,
 "writeErrorResults": [
  {
   "id": 1,
   "errorLayerId": 3
   "errors": [
    {
     "objectId": 168009,
     "globalId": "{7D9E9972-8E60-4523-A73E-3F3587166C10}",
     "errorType": "reshapeArea",
     "success": true
    },
    {
     "objectId": 168010,
     "globalId": "{486FFE9D-CFE8-432B-9D7D-1E7AF03E1BAE}",
     "errorType": "reshapeLine",
     "success": true
    }
   ]
  }
 ],
 "success": true
}

Example two:

The following is a sample response returned when returnEdits is set as true. The serviceEdits section provides details for the new errors created in the Error Layer table and documents the changes made to the fields in the applicable feature class.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
 "moment": 1708550294735,
 "writeErrorResults": [
  {
    "id": 1,
    "errorLayerId": 3
    "errors": [
    {
     "objectId": 168011,
     "globalId": "{0AB76E9A-9402-498C-8B3B-4DC6F2E1199D}",
     "errorType": "reshapeArea",
     "success": true
    }
   ]
  }
 ],
 "exceededTransferLimit": false,
 "serviceEdits": [
  {
   "id": 3,
   "editedFeatures": {
    "spatialReference": 4326 {
        ...
     "mUnits": 10000
    },
    "adds": [
     {
      "attributes": {
       "objectid": 168011,
       "featureclassid": 244,
	     ...
       "verificationdate": null
      },
      "geometry": {
       "x": -4465179.96812821738,
       "y": 3428970.41422226233,
       "z": 0,
       "m": null
      }
     }
    ]
   }
  },
  {
   "id": 1,
   "editedFeatures": {
    "spatialReference": 4326 {
	    ...
     "mUnits": 10000
    },
    "updates": [
     [
      {
       "attributes": {
        "objectid": 61,
	       ...
        "last_edited_user": null,
        "last_edited_date": null,
        "validationstatus": 2
       },
       "geometry": {
        "x": -4465180.71599999815,
        "y": 3428971.19269999862
       }
      },
      {
       "attributes": {
        "objectid": 61,
	       ...
        "last_edited_user": "admin",
        "last_edited_date": 1708550294000,
        "validationstatus": 3
       },
       "geometry": {
        "x": -4465180.71599999815,
        "y": 3428971.19269999862
       }
      }
     ]
    ]
   }
  }
 ],
 "success": true
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.