Select to view content in your preferred language

Update hosted feature service with a zip file, Unknown Error - error code: 500

06-19-2024 02:45 PM
New Contributor II


I'm seeking assistance to update my hosted feature layer titled "Stands_nd_statistics" using a zipped shapefile. My objective is to both update existing features with new data and add new features where necessary. I've attempted to achieve this using the append operation in ArcGIS Python API, but I encountered an Unknown Error with error code 500.

import arcpy, os, json,  zipfile
from arcgis.gis import GIS
from arcgis import features
from arcgis.mapping import WebMap
from arcgis.features import FeatureLayerCollection
from arcgis.features import FeatureLayer

gis = GIS("", "username", "password")

search_result ="title:Stands_nd_statistics", item_type = "Feature Layer")
layer_item = search_result[0]
feature_layer = FeatureLayer(layer_item.url)

# Upload the zipped shapefile as an item to your GIS
zip_path = r"P:\Projects\"
shapefile_item = gis.content.add({'title': 'Stands_nd_statistics_upload','type': 'Shapefile'}, data=zip_path)

feature_layer.append(, upload_format="shapefile", upsert=False)

Exception: Unknown Error

Any guidance or insights on how to troubleshoot and resolve this issue would be greatly appreciated! Thank you.

Tags (1)
0 Kudos
3 Replies
Occasional Contributor III

I'm seeing the same type of error as I posted here :

It looks like it could be a file size issue but I don't see anywhere in the updated documentation how to get around it.

0 Kudos
Esri Regular Contributor

Here's an idea. Load that shapefile into a spatial dataframe.

sdf = pd.DataFrame.spatial.from_featureclass("path\to\your\data\census_example\cities.shp")


Then append like this instead:


adds = sdf.spatial.to_featureset()


0 Kudos
Esri Esteemed Contributor

@LienPham1 have you tried executing ArcGIS Pro's Append tool?  This provides an upsert option which will update existing features with new data and add new features.  To use the upsert option, make sure the field your using in the hosted feature service has a unique index:




0 Kudos