<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic What is wrong with this code? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-this-code/m-p/1717133#M12004</link>
    <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;I am trying to overwrite an AGOL hosted feature class with API Python and testing it from ArcGIS Pro Notebook.&lt;/P&gt;&lt;P&gt;I am able to load the zipped FGDB in AGOL and overwrite the hosted feature class manually.&lt;/P&gt;&lt;P&gt;When I try to do the same thing with my program, selecting the same zipped FGDB, I get the following error message:&lt;/P&gt;&lt;PRE&gt;&amp;lt;Item title:"MyFGDB_3_gdb" type:Feature Layer Collection owner:xxxxxxxC&amp;gt;
item.type Feature Service
item.url &lt;A href="https://services.arcgis.com/8Pc9XBTAsYuxx9Ny/arcgis/rest/services/PCTSERP_3_gdb/FeatureServer" target="_blank" rel="noopener"&gt;https://services.arcgis.com/8Pc9XBTAsYuxx9Ny/arcgis/rest/services/MyFGDB_3_gdb/FeatureServer&lt;/A&gt;
item.title MyFGDB_3_gdb&lt;/PRE&gt;&lt;PRE&gt;&lt;BR /&gt;Overwriting AGOL Hosted Feature Layer... ***************************** ERROR REPORT STARTS Tue 07/28/2026 03:45:40 PM &amp;gt; Error ocurred in: File "C:/Users/e160795/AppData/Local/Temp/ArcGISProTemp29860/xpython_29860/3605199246.py", line 73, in &amp;lt;module&amp;gt; item.publish(overwrite=True, file_type="fileGeodatabase") &amp;gt; Error Class is: &amp;lt;class 'Exception'&amp;gt; &amp;gt; Available error details are: Unable to analyze item. Item type'url' is not supported for anzlyzing, The item needs to be of type file (Error Code: 400) ERROR REPORT ENDS&lt;BR /&gt;&lt;BR /&gt;This is my code:&lt;/PRE&gt;&lt;P&gt;# prepare signin object to AGOL&lt;BR /&gt;print ("Prepare signin object")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# This automatically logs you into the active AGOL/Portal session from ArcGIS Pro&lt;BR /&gt;gis = GIS("home")&lt;/P&gt;&lt;P&gt;# Verify your connection by printing your user details&lt;BR /&gt;print(f"Successfully logged in as: {gis.users.me.username}")&lt;/P&gt;&lt;P&gt;# publish Local File GEO DB&lt;BR /&gt;print ("Publish Local File GEO DB")&lt;BR /&gt;# --- Get the item ---&lt;BR /&gt;item = gis.content.get(item_id)&lt;BR /&gt;print(item)&lt;BR /&gt;&lt;BR /&gt;print(f"item.type {item.type}")&lt;BR /&gt;print(f"item.url {item.url}")&lt;BR /&gt;print(f"item.title {item.title}")&lt;/P&gt;&lt;P&gt;print("Overwriting AGOL Hosted Feature Layer...")&lt;BR /&gt;# Update the item with the new zipped File Geodatabase&lt;BR /&gt;&lt;BR /&gt;item.update(item_properties={}, data=zip_path)&lt;BR /&gt;&lt;BR /&gt;# Publish the new data, overwriting the old service&lt;BR /&gt;item.publish(overwrite=True, file_type="fileGeodatabase")&lt;/P&gt;&lt;P&gt;print("Overwrite Completed:")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2026 19:51:54 GMT</pubDate>
    <dc:creator>JoseSanchez</dc:creator>
    <dc:date>2026-07-28T19:51:54Z</dc:date>
    <item>
      <title>What is wrong with this code?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-this-code/m-p/1717133#M12004</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;I am trying to overwrite an AGOL hosted feature class with API Python and testing it from ArcGIS Pro Notebook.&lt;/P&gt;&lt;P&gt;I am able to load the zipped FGDB in AGOL and overwrite the hosted feature class manually.&lt;/P&gt;&lt;P&gt;When I try to do the same thing with my program, selecting the same zipped FGDB, I get the following error message:&lt;/P&gt;&lt;PRE&gt;&amp;lt;Item title:"MyFGDB_3_gdb" type:Feature Layer Collection owner:xxxxxxxC&amp;gt;
item.type Feature Service
item.url &lt;A href="https://services.arcgis.com/8Pc9XBTAsYuxx9Ny/arcgis/rest/services/PCTSERP_3_gdb/FeatureServer" target="_blank" rel="noopener"&gt;https://services.arcgis.com/8Pc9XBTAsYuxx9Ny/arcgis/rest/services/MyFGDB_3_gdb/FeatureServer&lt;/A&gt;
item.title MyFGDB_3_gdb&lt;/PRE&gt;&lt;PRE&gt;&lt;BR /&gt;Overwriting AGOL Hosted Feature Layer... ***************************** ERROR REPORT STARTS Tue 07/28/2026 03:45:40 PM &amp;gt; Error ocurred in: File "C:/Users/e160795/AppData/Local/Temp/ArcGISProTemp29860/xpython_29860/3605199246.py", line 73, in &amp;lt;module&amp;gt; item.publish(overwrite=True, file_type="fileGeodatabase") &amp;gt; Error Class is: &amp;lt;class 'Exception'&amp;gt; &amp;gt; Available error details are: Unable to analyze item. Item type'url' is not supported for anzlyzing, The item needs to be of type file (Error Code: 400) ERROR REPORT ENDS&lt;BR /&gt;&lt;BR /&gt;This is my code:&lt;/PRE&gt;&lt;P&gt;# prepare signin object to AGOL&lt;BR /&gt;print ("Prepare signin object")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# This automatically logs you into the active AGOL/Portal session from ArcGIS Pro&lt;BR /&gt;gis = GIS("home")&lt;/P&gt;&lt;P&gt;# Verify your connection by printing your user details&lt;BR /&gt;print(f"Successfully logged in as: {gis.users.me.username}")&lt;/P&gt;&lt;P&gt;# publish Local File GEO DB&lt;BR /&gt;print ("Publish Local File GEO DB")&lt;BR /&gt;# --- Get the item ---&lt;BR /&gt;item = gis.content.get(item_id)&lt;BR /&gt;print(item)&lt;BR /&gt;&lt;BR /&gt;print(f"item.type {item.type}")&lt;BR /&gt;print(f"item.url {item.url}")&lt;BR /&gt;print(f"item.title {item.title}")&lt;/P&gt;&lt;P&gt;print("Overwriting AGOL Hosted Feature Layer...")&lt;BR /&gt;# Update the item with the new zipped File Geodatabase&lt;BR /&gt;&lt;BR /&gt;item.update(item_properties={}, data=zip_path)&lt;BR /&gt;&lt;BR /&gt;# Publish the new data, overwriting the old service&lt;BR /&gt;item.publish(overwrite=True, file_type="fileGeodatabase")&lt;/P&gt;&lt;P&gt;print("Overwrite Completed:")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2026 19:51:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-this-code/m-p/1717133#M12004</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2026-07-28T19:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this code?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-this-code/m-p/1717137#M12005</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It seems very similar to &lt;A href="https://community.esri.com/t5/arcgis-online-questions/item-type-url-is-not-supported-for-anzlyzing-the/td-p/1059229" target="_self"&gt;this&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2026 19:57:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-this-code/m-p/1717137#M12005</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2026-07-28T19:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this code?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-this-code/m-p/1717551#M12006</link>
      <description>&lt;P&gt;This is what I did and now it works. Instead of trying to overwrite an existing group of hosted feature layers in AGOL, I just uploaded a FGDB and then refreshed individually each hosted feature class&amp;nbsp; (2 layers and 1 table) ,&lt;/P&gt;&lt;P&gt;See code below:&lt;/P&gt;&lt;P&gt;# --------------------------------------------------------------------&lt;BR /&gt;# Upload ZIP using Folder.add()&lt;BR /&gt;# --------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;# Root folder&lt;BR /&gt;folder = gis.content.folders.get()&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;upload = folder.add(&lt;BR /&gt;item_properties={&lt;BR /&gt;"title": "TempFGDBUpload",&lt;BR /&gt;"type": "File Geodatabase"&lt;BR /&gt;},&lt;BR /&gt;file=zip_path&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;# Wait for upload to complete&lt;BR /&gt;fgdb_item = upload.result()&lt;/P&gt;&lt;P&gt;print(f"Upload complete: {fgdb_item.id}")&lt;BR /&gt;&lt;BR /&gt;# Hosted Feature Layer&lt;BR /&gt;item = gis.content.get(item_id)&amp;nbsp; ##&amp;nbsp; id of the Hosted feature layer&amp;nbsp; in AGOL&lt;BR /&gt;#&lt;BR /&gt;# FCPoint&lt;BR /&gt;&lt;BR /&gt;layer = item.layers[0]&lt;BR /&gt;print(f"item: {item }")&lt;BR /&gt;print(f"layer: {layer}")&lt;BR /&gt;print(f"fgdb_item.id {fgdb_item.id}")&lt;BR /&gt;&lt;BR /&gt;# ----------------------------------------------------------&lt;BR /&gt;# Delete all records&lt;BR /&gt;# ----------------------------------------------------------&lt;/P&gt;&lt;P&gt;print("Deleting records...")&lt;BR /&gt;delete_result = layer.delete_features(where="1=1")&lt;BR /&gt;##print(delete_result)&lt;BR /&gt;&lt;BR /&gt;#--------------------------------------------------------&lt;BR /&gt;# Append data&lt;BR /&gt;# ----------------------------------------------------------&lt;BR /&gt;print("Appending features...")&lt;BR /&gt;append_result = layer.append(&lt;BR /&gt;item_id=fgdb_item.id,&lt;BR /&gt;upload_format="filegdb",&lt;BR /&gt;source_table_name="FCPoint"&lt;BR /&gt;)&lt;BR /&gt;print(append_result)&lt;/P&gt;&lt;P&gt;#&lt;BR /&gt;#PCTSLine&lt;BR /&gt;layer = item.layers[1]&lt;BR /&gt;print(f"layer: {layer}")&lt;BR /&gt;# ----------------------------------------------------------&lt;BR /&gt;# Delete all records&lt;BR /&gt;# ----------------------------------------------------------&lt;BR /&gt;print("Deleting records...")&lt;BR /&gt;delete_result = layer.delete_features(where="1=1")&lt;BR /&gt;##print(delete_result)&lt;BR /&gt;&lt;BR /&gt;#--------------------------------------------------------&lt;BR /&gt;# Append data&lt;BR /&gt;# ----------------------------------------------------------&lt;BR /&gt;print("Appending features...")&lt;BR /&gt;append_result = layer.append(&lt;BR /&gt;item_id=fgdb_item.id,&lt;BR /&gt;upload_format="filegdb",&lt;BR /&gt;source_table_name="FCLine"&lt;BR /&gt;)&lt;BR /&gt;print(append_result)&lt;BR /&gt;#&lt;BR /&gt;#Tbl&lt;BR /&gt;table = item.tables[0]&lt;BR /&gt;print(f"layer: {table}")&lt;BR /&gt;# ----------------------------------------------------------&lt;BR /&gt;# Delete all records&lt;BR /&gt;# ----------------------------------------------------------&lt;BR /&gt;print("Deleting records...")&lt;BR /&gt;delete_result = table.delete_features(where="1=1")&lt;BR /&gt;##print(delete_result)&lt;BR /&gt;&lt;BR /&gt;#--------------------------------------------------------&lt;BR /&gt;# Append data&lt;BR /&gt;# ----------------------------------------------------------&lt;BR /&gt;print("Appending features...")&lt;BR /&gt;append_result = table.append(&lt;BR /&gt;item_id=fgdb_item.id,&lt;BR /&gt;upload_format="filegdb",&lt;BR /&gt;source_table_name="tbl"&lt;BR /&gt;)&lt;BR /&gt;print(append_result)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# ---------------------------------------------------------------------&lt;BR /&gt;# Delete temporary uploaded FGDB from ArcGIS Online&lt;BR /&gt;# ---------------------------------------------------------------------&lt;BR /&gt;fgdb_item.delete(permanent=True)&lt;BR /&gt;print("Deleted temporary File Geodatabase item from ArcGIS Online.")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2026 11:20:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-this-code/m-p/1717551#M12006</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2026-07-30T11:20:59Z</dc:date>
    </item>
  </channel>
</rss>

