AnsweredAssumed Answered

Using applyedits with Ajax

Question asked by endlessdsire on Apr 14, 2016
Latest reply on Apr 14, 2016 by endlessdsire


Hello, im trying to add a new Feature in my rest service using ajax, but i got the following error:

  1. Object
    1. code:500
    2. details:Array[1]
      1. 0:"No edits ('adds', 'updates' or 'deletes') were specified."
      2. length:1
      3. __proto__:Array[0]
    3. message:"Unable to complete operation."

What am i doing wrong?

//Example url: http://myserverarcgis/arcgis/rest/services/mylayer/FeatureServer/1/applyEdits 
//My attributes from my layer are: user,from and module.

function saveLogin(){
  var arrayOfAttributes = [
    { "adds":[
      {
        "attributes" : {
          "user" : "Evelyn4",
          "from" : "Evelyn4",
          "module" : "Evelyn4"
        }
      }
    ]
  }
  ];

  var url = myLayers.write_logAccess();

  jQuery.ajax({
    type: 'POST',
    url: url,
    data: arrayOfAttributes,
    dataType:'json',
    success: (success) => {
      console.log(success);
    },
    error: (error) => {
      console.log(error);
    }
  });
}

Thanks for ur help .

Outcomes