Select to view content in your preferred language

gis.content.add returns an unnecessary 400 error

11-01-2023 02:23 AM
Labels (1)
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:

            "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

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\", 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\", 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\", 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\", line 12349, in __getattr__
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\", 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\", line 1445, in get_item
    return"content/items/" + itemid, self._postdata())
  File "c:\source\geodata-fme\geodata-fme\TME\COMMON\Python\VirtualEnv\pyruntime\lib\site-packages\arcgis\gis\_impl\_con\", 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\", 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\", 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:

0 Replies