ArcGIS Server allows the user to apply edits in an editable layer.

Eg the sample layer at http://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/3/applyEdits will accept a JSON input response such as [{'attributes': {'distance':1234}}]

Assuming that I have a JSON object in Python, how can I send this object to ArcGIS Server? ie, what is the Python syntax for Apply Edits?

I presume it's something along the lines of urllib2.urlopen(<endpoint>, <JSON>) but I can't figure out the exact syntax.

1 Answer 1


This syntax seems to work:

packet = {'attributes': {'distance': 12345}}
data = urllib.urlencode({'features': packet, 'f': 'pjson', 'rollbackOnFailure': True})
response = urllib2.urlopen(endPoint, data).read()

The result is:

[Dbg]>>> print(response)
  "addResults" : [
      "objectId" : 12, 
      "globalId" : null, 
      "success" : true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.