AGOL POST change attribute content

274
2
Jump to solution
09-28-2021 08:48 AM
Labels (1)
Hornblower5953
New Contributor II

I've managed to create a successful GET response from my Feature Layer.
What I really want to do is update the content of one of the attribute fields.
VBA

Reqeust.Open "POST" FL URL/updateFeatures&token=token from developer
Request.send(string that I created from a json response of the record I want to change, object ID and geometry included)

response says 404

am I barking up the wrong tree?

Thank you!

0 Kudos
1 Solution

Accepted Solutions
Hornblower5953
New Contributor II

YES YOU CAN!

VBA

strUpdate = "edits=[{""id"":0,""updates"":[{""geometry"":{""x"":-79.404111000222429,""y"":36.07058000026683},""attributes"":{""FID"":1,""Site_ID"":""DC10001"",""Site_Name"":""New Name"",""Status"":""NFA""}}]}]"

Request.Open "POST", "featureLayerURL(no layer id #)/applyEdits?f=json&token=" & strToken, False

Request.setRequestHeader "Content-type", "application/x-www-form-urlencoded"

Request.send (strUpdate)

View solution in original post

0 Kudos
2 Replies
Hornblower5953
New Contributor II

Does anyone know if it is even possible change an AGOL feature layer attribute using REST?

0 Kudos
Hornblower5953
New Contributor II

YES YOU CAN!

VBA

strUpdate = "edits=[{""id"":0,""updates"":[{""geometry"":{""x"":-79.404111000222429,""y"":36.07058000026683},""attributes"":{""FID"":1,""Site_ID"":""DC10001"",""Site_Name"":""New Name"",""Status"":""NFA""}}]}]"

Request.Open "POST", "featureLayerURL(no layer id #)/applyEdits?f=json&token=" & strToken, False

Request.setRequestHeader "Content-type", "application/x-www-form-urlencoded"

Request.send (strUpdate)

0 Kudos