I am trying to add a feature to a service layer using ajax post. I get a 200 back but when i query the service, the post feature does not show. I am using ArcGis Online 1.5.1
service:
https://services2.arcgis.com/qvkbeam7Wirps6zC/ArcGIS/rest/services/service_e85611f4185545fab4a50ca81ca14ebf/FeatureServe…
I finally fixed it, for some reason it wanted me to post my data as a string in the url, instead of withing my request body. Here is the code for anyone that wants to try this:
const url = 'https://services2.arcgis.com/qvkbeam7Wirps6zC/ArcGIS/rest/services/service_e85611f4185545fab4a50ca81ca14ebf/FeatureServer/0/addFeatures?features='+ encodeURIComponent(JSON.stringify(data)) +'&f=json';
var request = new Request(url, { method: 'POST', body: '', headers: new Headers() });
fetch(request) .then((resp) => { console.log(resp); console.log(resp.status); if(resp.status === 200){ console.log('item submitted'); } });
No it should not be necessary. can you post the code you are using for the AJAX Post?
I have light a custom application with a form that post to our service. Do I need arcgis.js to do any edits to services?
Edgar,
Can you elaborate as to why you are attempting to add the feature using AJAX instead of the FeatureLayer.applyEdits([new features]) method?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.