Item type'url' is not supported for anzlyzing, The item needs to be of type file

1427
6
Jump to solution
05-18-2021 03:41 PM
MikeMacRae
Occasional Contributor III

Hello all. I am not sure if this is a python question or an ArcGIS Online question, but my feeling it's more the layer.

 

I am using the ArcGIS for Python API to update a hosted feature layer. I developed this tool quite a few months ago and has run like clock work. This week, I am experiencing an error that isn't making much sense since the tool has always worked. The error is:

Traceback (most recent call last):

pwr.publish(overwrite=True, file_type='fileGeodatabase')

Exception: Unable to analyze item.
Item type'url' is not supported for anzlyzing, The item needs to be of type file
(Error Code: 400)

My code basically takes a zipped geodatabase and updates the hosted feature layer based on the Item ID:

 

from arcgis.gis import GIS
import os

def updateAGOData():
    gis = GIS("myoraganizationURL", agol_username, agol_password)
    dataLoc = r"C:\data"
    arcpy.AddMessage("Connected to ArcGIS Online...")
     
    PWR_item = os.path.join(dataLoc, "zip_file\Data.zip")
     
    pwr = gis.content.get('cf755f973b4a4f19a0e2e80425d30188')
    pwr.update({}, PWR_item)
    pwr.publish(overwrite=True, file_type='fileGeodatabase')

    arcpy.AddMessage("Hosted Feature Layer Updated...")
        
updateAGOData()

 

 

Now, to answer a few questions:

  • The code has not changed since last fall
  • The geodatabase has not changed at all.
  • the Item ID has not changed at all
  • My organizations URL has not changed at all
  • The path to the data has not changed.

Like, nothing has changed at all. I have the the script running on a task scheduler daily for months now and it has never failed until now.

I tested to make sure the zipped geodatabase isn't the issue by manually updating the hosted feature layer and that works fine. The hosted feature layer gets updated.

The message is cryptic to me:

Item type'url' is not supported for anzlyzing, The item needs to be of type file

The error throws when when the script sets to the 'Update' method and yes....it legitimately prints out 'anzlyzing'...🤔

 

There is an older post mentioning the same issue with no solution: https://community.esri.com/t5/arcgis-api-for-python-questions/item-type-url-is-not-supported-for-anz...

 

0 Kudos
1 Solution

Accepted Solutions
MikeMacRae
Occasional Contributor III

Thanks everyone. I did some more sleuthing and tried a range of troubleshooting. Finally I called ESRI Support and we walked through my script and discovered that I was using the wrong Item ID. When you publish a zipped file geodatabase as a hosted feature layer, 2 items are created. The hosted feature service and the underlying geodatabase. See below:

MikeMacRae_0-1630020447291.png

On the line from my script above, i.e.:

 

pwr = gis.content.get('cf755f973b4a4f19a0e2e80425d30188')

 

 I was using the item id from the 'Feature Layer (Hosted)' service layer, where I should have been using the item id from the File Geodatabase item. My script works once again. Hope that helps those who run into the same issue.

View solution in original post

0 Kudos
6 Replies
MichaelVolz
Esteemed Contributor

Does the zipped up file gdb only contain 1 feature class for a single layer hosted feature layer or does it contain multiple feature classes for a multi-layer hosted feature layer?

0 Kudos
MikeMacRae
Occasional Contributor III

It's one feature class. I've actually tested by rebuilding the geodatabase and feature class and uploading as a new hosted feature layer and then running the overwrite and update with the same result.

0 Kudos
MichaelVolz
Esteemed Contributor

Have you looked at the below URL for updating a hosted feature layer

https://www.esri.com/arcgis-blog/products/analytics/analytics/updating-your-hosted-feature-services-...

It is different from your script but I think it would achieve the same end result of overwriting a hosted feature layer.  I was able to get this script to work in my environment after making the necessary changes.

0 Kudos
MikeMacRae
Occasional Contributor III

Thanks @MichaelVolz I had a look at the link but there isn't much different from what I am doing. The basics of the update in my code came from the ArcGIS API for Python sample scripts and as I mentioned, had been working for months. I'm at a dead end here. I've tested on a couple different ArcGIS setups we have in my organization and I am encountering the error everywhere...

0 Kudos
LouieDowney
New Contributor

I ran into this exact same problem today.  I wound up deleting the old hosted geodatabase and hosted feature service in arcgis online and republishing the file, updating my script with the new item id, and it miraculously started working again.

MikeMacRae
Occasional Contributor III

Thanks everyone. I did some more sleuthing and tried a range of troubleshooting. Finally I called ESRI Support and we walked through my script and discovered that I was using the wrong Item ID. When you publish a zipped file geodatabase as a hosted feature layer, 2 items are created. The hosted feature service and the underlying geodatabase. See below:

MikeMacRae_0-1630020447291.png

On the line from my script above, i.e.:

 

pwr = gis.content.get('cf755f973b4a4f19a0e2e80425d30188')

 

 I was using the item id from the 'Feature Layer (Hosted)' service layer, where I should have been using the item id from the File Geodatabase item. My script works once again. Hope that helps those who run into the same issue.

0 Kudos