Select to view content in your preferred language

gis.content.add returns an unnecessary 400 error

329
0
11-01-2023 02:23 AM
Labels (1)
StijnSchoutenTheGISLord
New Contributor II

Describe the bug
Goal: upload a GeoJson file to ArcGIS Online via the function gis.content.add(). In the add function I'm using a Azure Blob file as source instead of a regular data upload

To Reproduce
Steps to reproduce the behavior:

gis_engine.content.add(item_properties={
            "type": "GeoJson",
            "title": f"upload",
            "spatialReference": "EPSG:4326",
            "dataUrl": <blob_url>,
            "overwrite": True
        })
 

Any blob url will work for reproducing this. I'm using a geojson of around 11mb
error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\__init__.py", line 6019, in add
    item = Item(self._gis, itemid)
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\__init__.py", line 12100, in __init__
    if self._has_layers():
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\__init__.py", line 12178, in _has_layers
    self.type == "Feature Collection"
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\__init__.py", line 12349, in __getattr__
    self._hydrate()
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\__init__.py", line 12301, in _hydrate
    itemdict = self._portal.get_item(self.itemid)
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\_impl\_portalpy.py", line 1445, in get_item
    return self.con.post("content/items/" + itemid, self._postdata())
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 1557, in post
    return self._handle_response(
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 1027, in _handle_response
    self._handle_json_error(data["error"], errorcode)
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 1052, in _handle_json_error
    raise Exception(errormessage)
Exception: Item does not exist or is inaccessible.
(Error Code: 400)
 

Expected behavior
A returned item that is uploaded successfully. Note that the item, in my case, is still uploaded to ArcGIS Online. After scanning through the REST API docs it seems that this function will return a promise first. Maybe the Python API is not handling this correctly

 

Made a Github ticket as well: https://github.com/Esri/arcgis-python-api/issues/1703

0 Replies