gzhong-esristaff

How to call addFeatures  operation of a feature service programmatically

Discussion created by gzhong-esristaff on Jan 23, 2012
Latest reply on Jan 23, 2012 by gzhong-esristaff
Hi, All,

I have a quick question of how to call add Features function from my code. Anybody could share your code snippet would be greatly appreciated. I got error message saying parameters are not valid if I try this:

request.features = {[
      {
      "attributes" : {
        "req_id" : "508389",
        "req_type" : "Graffiti Complaint - Public Property",
        "req_date" : "09\/19\/2009",
        "req_time" : "18:44",
        "address" : "11TH ST and HARRISON ST",
        "x_coord" : "6008925.0",
        "y_coord" : "2108713.8",
        "district" : "6",
        "status" : 1
      },
      "geometry" : {
        "x" : -122.41247978999991,
        "y" : 37.770630098000083
      }
    }
    ]};

url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/addFeatures";
  getJson(request, url, handler, errorHandler);
};

getJson: function (request, uri, handler, errorHandler) {

request.f = "json";

    dojo.io.script.get({
      url: uri,
   content: request,
      callbackParamName: "callback",
      load: function (result, args) {
        cmp.util.handler(result, args, uri, handler, errorHandler);
      },
      error: function (result, args) {
        cmp.util.errorHandler(result, args, uri, errorHandler);
      }
    });
  }

Should I use post method instead of get method even though my data is very small?

Thanks,

Gang

Outcomes