I am trying to figure out how I would go about do basic CRUD on a feature service table using esri/request in 4.x and any example code would be greatly appreciated.
Hi, I do not have the code handy however you will need to use the rest add-feature endpoint
I imagine it will be something like the following. Note code below are untested
You can also open your developer tool in chrome and hit the addfeature endpoint, set f=json to see exactly how you should be parsing the request and replicate that in esriRequest.
https://developers.arcgis.com/rest/services-reference/add-features.htm
var data = [ { "geometry" : {"x" : -118.15, "y" : 33.80}, "attributes" : { "OWNER" : "Joe Smith", "VALUE" : 94820.37, "APPROVED" : true, "LASTUPDATE" : 1227663551096 } }, { "geometry" : { "x" : -118.37, "y" : 34.086 }, "attributes" : { "OWNER" : "John Doe", "VALUE" : 17325.90, "APPROVED" : false, "LASTUPDATE" : 1227628579430 } }]
var url = "https://abc/ArcGIS/rest/services/xyz//FeatureServer/0/addFeature "
esriRequest(, { responseType: "json",
method:"post",
body:JSON.stringify(data)}).then(function(response){ });
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.