I'm using ArcGIS Python API v2.0.0 and trying to append data to hosted feature layer in ArcGIS Enterprise v10.9.1.
It fails with a message "Append only available on ArcGIS Online".
Regarding the documentation: "The append method is only available in ArcGIS Online and ArcGIS Enterprise 10.8.1+".
Am I missing something?
It seems this should be resolved in 2.0.1: https://github.com/Esri/arcgis-python-api/issues/1265.
However trying to append data into ArcGIS Enterprise using the 2.0.1 version, it throws another exception:
Exception Traceback (most recent call last)
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\features\layer.py in append(self, item_id, upload_format, source_table_name, field_mappings, edits, source_info, upsert, skip_updates, use_globalids, update_geometry, append_fields, rollback, skip_inserts, upsert_matching_field, upload_id, return_messages, future)
2376 url = self._url + "/append"
2377 del cparams
-> 2378 res = self._con.post(path=url, postdata=params)
2379 if future:
2380 executor = concurrent.futures.ThreadPoolExecutor(1)
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis_impl_con_connection.py in post(self, path, params, files, **kwargs)
-> 1412 force_bytes=kwargs.pop("force_bytes", False),
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis_impl_con_connection.py in _handle_response(self, resp, file_name, out_path, try_json, force_bytes, ignore_error_key)
898 return data
899 errorcode = data["error"]["code"] if "code" in data["error"] else 0
--> 900 self._handle_json_error(data["error"], errorcode)
901 return data
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis_impl_con_connection.py in _handle_json_error(self, error, errorcode)
922 errormessage = errormessage + "\n(Error Code: " + str(errorcode) + ")"
--> 923 raise Exception(errormessage)
925 def post_multipart(
Exception: Error downloading item from Portal.
(Error Code: 500)
Nobody is doing a programmatic data append against ArcGIS Enterprise?
I just wanted to let you know that Esri did fix the append issue in ArcGIS API for Python 2.1.0. Unfortunately, ArcGIS API for Python would not update for me in my ArcGIS 3.0.3 conda environment. To get around that I downloaded the code from Esri's conda repository. The append function is in .\Lib\site-packages\arcgis\features\layer.py and I copied it from the 2.1.0 version. Then in the layer.py file in my 2.0.1 version conda environment I deleted the append function and pasted in the newer version. Finally I saved the layer.py file. Now my appends are working again in my scripts.
It would be nice if Esri would add fixes like this to version of the ArcGIS API for Python that are used by their current products instead of making us wait for the next product release.