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

asked May 25, 2014 at 19:59

1 Answer 1

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.

answered May 26, 2014 at 18:49
1
  • its my pleasure :) Commented May 27, 2014 at 20:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.