2

I am developping a web application that uses a feature service, what i want to do is save the data in the feature server, and then delete all the features at the start of the application. I am able to save data in the feature service, my problem is how to delete the features in the start of the application. I found a solution to that suggesting that I use the operation: "Delete Features" of the REST API, but I think I am making a mistake in the syntax, here is my code sample:

var theurl= "***/arcgis/rest/services/edt/FeatureServer/0/deleteFeatures"
var request = esri.request({

url: theurl,
// Service parameters if required, sent with URL as key/value pairs
content: {
f: "json",
where: "1=1"}

});

I don't know what I am missing can you please help

3

the best way to get an idea of what you need to do in your javascript app to interact with ArcGIS Server or ArcGIS Online services successfully is to play around with the REST endpoint for a particular operation interactively and snoop the web traffic to see what requests you are sending.

in this case, the syntax you need would look something like this

esriRequest({
      "url": "http://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0/deleteFeatures",
      "content": {
        "objectIds": 123,
        "f": "json"
        }
      }, {"usePost": true
    });

heres a fiddle.

the featureLayer.applyEdits() method is an alternative you might explore as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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