Select to view content in your preferred language

How do I programatically update the attribute of a single feature in a hosted feature service?

6394
5
Jump to solution
02-17-2015 02:31 PM
MStayner
Occasional Contributor

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.

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

By using a post request "Update Features". See ArcGIS REST API

View solution in original post

0 Kudos
5 Replies
XanderBakker
Esri Esteemed Contributor

By using a post request "Update Features". See ArcGIS REST API

0 Kudos
FilipKrál
Frequent Contributor

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.

0 Kudos
FilipKrál
Frequent Contributor

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.

0 Kudos
OwenEarley
Frequent Contributor

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.

0 Kudos
MStayner
Occasional Contributor

Thanks!  he ArcGIS REST API definitely looks like the best option for me!

0 Kudos