agrc / palletjack

A library for updating AGOL data from various external sources
https://agrc.github.io/palletjack/palletjack/
MIT License
12 stars 0 forks source link

Limit fields for adds/updates #28

Open jacobdadams opened 1 year ago

jacobdadams commented 1 year ago

I can't figure out how to get the append_fields parameter to not throw Error 500 (unknown error)s. So for now, new dataframe fields must match existing fields. Later I can figure out how to get append_fields working properly (may need to chat w/Esri).

steveoh commented 1 year ago

Where does append_fields get used?

jacobdadams commented 1 year ago

It's listed in the FeatureLayer.append() arguments.

After a little more (inadvertent) testing, it looks like it doesn't throw the error if append_fields includes all the fields in the live layer (which negates the point of subsetting with append_fields...)

steveoh commented 1 year ago

can this operation be done in the pro gui and exported to python to see what it's expecting?

jacobdadams commented 1 year ago

I don't think so- this is ArcGIS API for Python, not arcpy. The "try the different/native form" check would be an HTTP post request using https://developers.arcgis.com/rest/services-reference/enterprise/append-feature-service-layer-.htm

steveoh commented 1 year ago

so something like this example?

POST /webadaptor/rest/services/MyService/FeatureServer/0/append HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

sourceTableName=MyShapes&fieldMappings=[{"source":"myShapeDate","name":"datefield"},{"source":"myData","name":"mydata"},{"source":"myData2","name":"mydata2"},{"source":"FID","name":"objectid"}]&upsert=true&skipInserts=false&updateGeometry=true&appendFields=["datefield","mydata","mydata2","objectid"]&appendUploadId=62b7e088a2ff4b3da1a240d72f9994e3&appendUploadFormat=shapefile&rollbackOnFailure=true&f=json