UpdateFeature REST API Python Script Unexpected Error
I am trying to update an ArcGIS Online hosted feature using a python script. I have tried a few examples of using Post methods combined with the Example Usage from the ArcGIS REST API documentation for UpdateFeature(http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Update_Features/02r3000000zt000000/) but in each case I get the following error:
{"error":{"code":500,"message":"An unexpected error occurred processing the request.","details":[]}}
I am using a json array of features that successfully updates the feature when manually submitted in the form at http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/updateFeatures.
Here is the code I use for the requests method:
updateBaseURL = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/updateFeatures/?&f=json"
updateAttr = [
{
"attributes" : {
"objectid": 12976095,
"address" : "66TH ST and HARRISON ST"
}
}
]
headers = {"Content-type": "application/json", "Accept": "text/plain"}
r = requests.post(updateBaseURL, json=updateAttr,headers=headers)
Here is the code I use for the HTTPConnection method:
updateAttr = [
{
"attributes" : {
"objectid": 12976095,
"address" : "66TH ST and HARRISON ST"
}
}
]
headers = {"Content-type": "application/json", "Accept": "text/plain"}
conn = httplib.HTTPConnection('sampleserver3.arcgisonline.com')
conn.request("POST", "/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/updateFeatures/?f=json", json.dumps(updateAttr), headers)
How Can I make this work?