Use REST api for editing directly

Discussion created by zconlen on Apr 25, 2012
Latest reply on Apr 30, 2012 by zconlen
I need to edit a stand alone table in my javascript api application. I thought it woud be simple to do this with restful request, but having problems.

I have a proxy page set up and apparently working. Here is code snippet using public arcgis server resource. I have hard-coded the content for now. Once I get it working, the input will be dynamically generated.

//proxy page...
esri.config.defaults.io.proxyUrl = "../GISProxy/proxy.ashx";

//function to edit features
function addFeature(){
    var requestHandle = esri.request({
      url: "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/1/addFeatures",
      content: '[{"attributes" : {"agree_with_incident" : "2", "notes" : "problemo grande"}}]',
      handleAs: "json",
      load: requestSucceeded,
      error: requestFailed
  }, {useProxy:true});

The request fails. I suspect it is a problem with the content property. When I go to the above url and enter that string into the dialog, it is sucessful, but how to do this with ajax?

Thanks for any tips.