Update Definition (Feature Layer)

Description

The updateDefinition operation supports updating a definition property in a feature service layer. The result of this operation is a response indicating success or failure with error code and description.

Parameters

ParameterDetails
f

Description: The response format. The default response format is html.

Values: html | json | pjson

updateDefinition

Description: The service update to the layer definition property for a feature service layer.

async

Description: Support options for asynchronous processing. The default format is false.

Values: html | json | pjson

Example usage

Example 1: Enable attachments on a feature service layer

Example 2: Rename feature service layer

Example 3: Update feature service layer renderer

Example 4: Update feature service time info

Example 5: Update other feature service layer properties

Example 6: Update feature service domain and alias

Example 7: Update definition: Rebuild index

Example 8: Update definition: Multi-scale geometry

Example 1: Enable attachments on a feature service layer:

http://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example1/FeatureServer/0/updateDefinition

Example input (POST body)

{ "hasAttachments" : true }

JSON Response syntax

{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON Response example (when updateDefinition succeeds)

{
  "success" : true
}

JSON Response example (when updateDefinition fails)

{
  "error" : 
  {
    "code" : 400, 
    "message" : "", 
    "details" : [
      "Unable to update feature service layer definition."
    ]
  }
}

Example 2: Rename feature service layer:

http://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example2/FeatureServer/0/updateDefinition

Example input (POST body)

{ "name":"newName" }

JSON Response syntax

{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON Response example (when updateDefinition succeeds)

{
  "success" : true
}

JSON Response example (when updateDefinition fails)

{
  "error" : 
  {
    "code" : 400, 
    "message" : "", 
    "details" : [
      "Unable to update feature service layer definition."
    ]
  }
}

Example 3: Update feature service layer renderer:

http://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example3/FeatureServer/1/updateDefinition

Example input (POST body)

{ "drawingInfo": {
  "renderer": {
   "type": "uniqueValue",
   "field1": "symbolid",
   "field2": null,
   "field3": null,
   "fieldDelimiter": ", ",
   "defaultSymbol": null,
   "defaultLabel": null,
   "uniqueValueInfos": [
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 2
     },
     "value": "1",
     "label": "Active Burnout",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       169,
       0,
       230,
       255
      ],
      "width": 13
     },
     "value": "0",
     "label": "Aerial Hazard",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 15
     },
     "value": "3",
     "label": "Completed Burnout",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 18
     },
     "value": "4",
     "label": "Completed Dozer Line",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       56,
       168,
       0,
       255
      ],
      "width": 12
     },
     "value": "6",
     "label": "Escape Route",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 18
     },
     "value": "7",
     "label": "Fire Break Planned or Incomplete",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 28
     },
     "value": "9",
     "label": "Foam Drop",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 16.350000381469727
     },
     "value": "13",
     "label": "Management Action Point (MAP)",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 8
     },
     "value": "15",
     "label": "Planned Secondary Line",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 15
     },
     "value": "16",
     "label": "Proposed Burnout",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 18
     },
     "value": "18",
     "label": "Retardant Drop",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       255,
       0,
       0,
       255
      ],
      "width": 4
     },
     "value": "19",
     "label": "Uncontrolled Fire Edge",
     "description": ""
    },
    {
     "symbol": {
      "type": "esriSLS",
      "style": "esriSLSSolid",
      "color": [
       0,
       0,
       0,
       255
      ],
      "width": 33.75000190734863
     },
     "value": "21",
     "label": "Division Break",
     "description": ""
    }
   ]
  },
  "transparency": 0,
  "labelingInfo": null
 }
}

JSON Response syntax

{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON Response example (when updateDefinition succeeds)

{
  "success" : true
}

JSON Response example (when updateDefinition fails)

{
  "error" : 
  {
    "code" : 400, 
    "message" : "", 
    "details" : [
      "Unable to update feature service layer definition."
    ]
  }
}

Example 4: Update feature service layer time info:

http://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example4/FeatureServer/1/updateDefinition

Example input (POST body)

{ 
  "timeInfo" : {
    "startTimeField" : "startTime",
    "endTimeField" : "endTime"
  }
}

JSON Response syntax

{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON Response example (when updateDefinition succeeds)

{
  "success" : true
}

JSON Response example (when updateDefinition fails)

{
  "error" : 
  {
    "code" : 400, 
    "message" : "", 
    "details" : [
      "Unable to update feature service layer definition."
    ]
  }
}

Example 5: Update feature service layer properties:

http://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example5/FeatureServer/1/updateDefinition

Example input (POST body)

{ 
  "xssTrustedFields" : "field1, field2",
  "displayField" : "field1", 
  "description" : "", 
  "copywriteText" : "", 
  "minScale" : 0,
  "maxScale" : 0,
  "maxRecordCount" : 1000,
  "standardMaxRecordCount" : 4000,
  "tileMaxRecordCount" : 4000,
  "maxRecordCountFactor" : 1,
  "types" : "",
  "templates" : "",
  "defaultVisibility" : true,
  "typeIdField" : ""
}

JSON Response syntax

{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON Response example (when updateDefinition succeeds)

{
  "success" : true
}

JSON Response example (when updateDefinition fails)

{
  "error" : 
  {
    "code" : 400, 
    "message" : "", 
    "details" : [
      "Unable to update feature service layer definition."
    ]
  }
}

Example 6: Update feature service domain and alias:

http://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example6/FeatureServer/1/updateDefinition

Example input (POST body)

{ 
{
  "fields": [
    {
      "name": "SUB_REGION",
      "alias": "SUBREGIONTEST",
      "domain": {
        "type": "codedValue",
        "name": "SubRegion123",
        "codedValues": [
          {
            "name": "E N Cen",
            "code": "ENC"
          },
          {
            "name": "E S Cen",
            "code": "SEC"
          },
          {
            "name": "Mid Atl ",
            "code": "MA"
          },
          {
            "name": "Mtn",
            "code": "MTN"
          },
          {
            "name": "N Eng",
            "code": "NE"
          },
          {
            "name": "Pacific",
            "code": "PAC"
          },
          {
            "name": "S Atl ",
            "code": "SA"
          }
        ]
      },
      "defaultValue": null
    }
  ]
}

JSON Response syntax

{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON Response example (when updateDefinition succeeds)

{
  "success" : true
}

JSON Response example (when updateDefinition fails)

{
  "error" : 
  {
    "code" : 400, 
    "message" : "", 
    "details" : [
      "Unable to update feature service layer definition."
    ]
  }
}

Example 7: Update definition: Rebuild index:

http://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example7/FeatureServer/1/updateDefinition

Example input (POST body)

{ 
{
"indexes" : [
    {
      "name" : "user_11.bookmarkspatialreference_WFL_Wilson_HydroArc_Shape_sidx", 
      "fields" : "Shape"
   }
  ]
}

JSON Response syntax

{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON Response example (when updateDefinition succeeds)

{
  "success" : true
}

JSON Response example (when updateDefinition fails)

{
  "error" : 
  {
    "code" : 400, 
    "message" : "", 
    "details" : [
      "Unable to update feature service layer definition."
    ]
  }
}

Example 8: Update definition: Optimize drawing of complex lines and polygons

http://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example7/FeatureServer/1/updateDefinition

  • The operation is only supported when the layer metadata has supportsMultiScaleGeometry=true and when async=true.
  • The multi-scale geometry is supported on polyline and polygon data in any projection but it can be used only when the output projection is Mercator (102100).
  • The Mercator levels of resolution are used when creating the multi-scale geometry. Supported generalization levels are [1-17].
  • When editing or syncing the data, the multi-scale geometries are updated.
  • At query time, we use the maxAllowedOffset or the quantization offset to determine the generalized geometry for that level. If the shape for the requested level does not exist, we use the closest generalized geometry. For instance, if the user requests level 5 geometry and it does not exist, we search for the next generalized geometry (6 or higher).

Example input (POST body)

  • If you pass the levels AND/OR the minReductionFactor, we build the multi-scale geometries for these levels or when the difference between the actual geometry and the generalized geometry is greater than the minReductionFactor.
  • We identify the first level to build based on the extent of the data. We try to find the level where the Mercator cell contains all the data.
  • The minReductionFactor is between [0,1]. The default is 0.2.

Enable multi-scale geometry on a layer

{
  "multiScaleGeometryInfo" : {
  "levels" : [1, 3, 5, 7, 9]
  }
}

Or

{
  "multiScaleGeometryInfo" : {
  "levels" : [],
   "minReductionFactor" : 0.1  // Optional : default 0.2
  }
}

To disable multi-scale geometry.

{
  "multiScaleGeometryInfo" : null
}

JSON Response syntax

{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON Response example (when updateDefinition succeeds)

{
  "success" : true
}

JSON Response example (when updateDefinition fails)

{
  "error" : 
  {
    "code" : 400, 
    "message" : "", 
    "details" : [
      "Unable to update feature service layer definition."
    ]
  }
}