I am collecting user data on my website. I want to take that data and update the attribute of a singel feature in a hosted feature service. I am an authenticated user and I know the URL of the hosted features service and GlobalID of the actual feature, but I'm know sure how to go about pushing the updated data.
I'm using the Javascript API and Python on my server.
Solved! Go to Solution.
By using a post request "Update Features". See ArcGIS REST API
By using a post request "Update Features". See ArcGIS REST API
Hi, the REST API operation to do this is ApplyEdits on a Feature Layer resource. See ArcGIS REST API Apply Edits.
If you want to update a feature using ArcGIS JS API, the applyEdits method of a Feature Layer object should do the trick if you supply the feature you want to update in the updates parameter (note that it is an array): FeatureLayer | API Reference | ArcGIS API for JavaScript
Hope this helps,
Filip.
Oh yeah, I didn't see the UpdateFeatures rest end point pointed out by Xander Bakker. That makes much more sense. Although I cannot see if that is directly accessible through the ArcGIS JS API.
You should be able to post a standard request to that end point though, which might be easier than using the applyEdits method anyway.
From memory - when using Update Features in the REST API you need to pass in the ObjectId of the feature(s) you want to update. This may be an issue if you only have the GlobalId value as you would need a separate query to get the ObjectId for a known GlobalId.
Thanks! he ArcGIS REST API definitely looks like the best option for me!