Skip To Content
ArcGIS Developer
Dashboard

Update Definition (Feature Service)

Description

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

Request parameters

ParameterDescription
updateDefinition

The service update to the service definition property in a feature service.

async

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

Values: true | false

f

The response format. The default response format is html.

Values: html | json | pjson

Example usage

https://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example/FeatureServer/updateDefinition

Example one: Enable editor tracking and ownership access control in a feature service

The example below is a sample JSON object for the updateDefinition parameter that demonstrates how to enable editor tracking and ownership access control in a feature service. The following request is formatted for readability:


{
  "editorTrackingInfo": {
    "enableEditorTracking": true,
    "enableOwnershipAccessControl": true,
    "allowOthersToUpdate": true,
    "allowOthersToDelete": false
  }
}

Example two: Update feature service capability

The following example is a sample JSON object for the updateDefinition parameter that demonstrates how to update the feature service's capabilities:


{"capabilities":"Create,Query"}

Example three: Enable feature service sync

The following example is a sample JSON object for the updateDefinition parameter that demonstrates how to enable sync on a feature service:


{"syncEnabled": true}

Example four: Update feature service properties

The example below is a sample JSON object for the updateDefinition parameter that demonstrates how to update a feature service's properties. The following request is formatted for readability:


{
  "name": "SanFrancisco2", 
  "hasStaticData": false, 
  "allowGeometryUpdates": "true",
  "maxRecordCount": 2000, 
  "serviceDescription": "SanFrancisco2",  
  "description": "",     
  "copyrightText": "",
  "units": "",
  "xssPreventionInfo": {
    "xssPreventionEnabled": true, 
    "xssPreventionRule": "InputOnly", 
    "xssInputRule": "rejectInvalid"
  },   
  "initialExtent": {
    "xmin": -122.514435102,
    "ymin": 5.6843418860808E-14,
    "xmax": 138.625776397,
    "ymax": 67.1577965990001
  }
}

Note:

XSS properties are set to define how attribute edits are treated when editing data.

"xxsPreventionEnabled": <true|false>—This property is true by default and is used to block attribute edits containing potentially harmful content. If it's set to false, no attempt will be made to block potentially harmful content. You can optionally fine tune this behavior with the following xss properties:

  • "xssPreventionRule": <input|inputOutput>—If it's set to input, attributes containing potentially harmful content will be blocked. If it's set to inputOutput, attribute edits containing potentially harmful content will be blocked and query results containing potentially harmful content will be encoded.
  • "xssInputRule": <rejectInvalid|sanitizeInvalid>—When this is set to rejectInvalid, attribute edits containing potentially harmful content will be blocked. When this is set to sanitizeInvalid, edits will be encoded, but potentially harmful attribute edits will be allowed.

Example five: Add the preferred time zone property

The example below is a sample JSON object for the updateDefinition parameter that demonstrates how to set the preferred time for a hosted feature service. The preferred time is the time zone the service author recommends clients to work in. Preferred time is used by newer clients, such as ArcGIS Pro 2.7 (and above), which defaults to working with date values in the preferred time reference.

Once the update completes, the feature service resource and all layer resources will have the preferredTimeReference set. To unset preferredTimeReference, run updateDefinition with "timeZone": null.

Note:

For a list of all available time zone IDs, see the Microsoft Time Zone Index Values reference page.

The following request is formatted for readability:


{
  "preferredTimeReference": {
    "timeZone": "Pacific Standard Time",
    "respectsDaylightSaving": true
  }
}

JSON Response syntax


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

JSON Response examples

When updateDefinition succeeds:


{
  "success": true
}

When updateDefinition fails:


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