You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When providing an update to the typeKeywords key, if appropriate values are not provided, then a series of default values are inserted into the item's typeKeywords. These may be substantially different from the default values assigned during the item's creation. This can provide a number of unintended consequences, most notably with the Site Application item type where the lack of a hubsubdomain|some-site keyword effectively removes access to the site.
To Reproduce
Steps to reproduce the behavior:
# we assume here a variety of item types: Dashboard, Web Experience, Feature Service, Web Map, Site Applicationsource=arcgis.gis.GIS()
foriteminitemid_list:
source_item=source.content.get(item)
print(f"{source_item.itemid} | {source_item.type} | {source_item.title} | {source_item.owner}")
print(f"\ttypeKeywords: {source_item.typeKeywords}")
print("\tupdating typeKeywords with 'TEST-keyword'")
source_item.update({"typeKeywords": "TEST-keyword"})
source_item=source.content.get(item)
print(f"\ttypeKeywords: {source_item.typeKeywords}\n")
Expected behavior
The current documentation is lackluster for those unfamiliar with using the ArcGIS REST API, when utilizing update my expectation is that it appends a singular value, and wholesale replacement of the values would require a comma separated list. This erroneous thought process was compounded by the fact that items continued to operate, returned a number of typeKeywords including the singular value that was provided. As stated above, this behavior was not fully understood until the Site Application became inoperative.
A few thoughts,
first, this section in the documentation could be expanded to make this behavior more explicit / clear.
-- developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.update
-- a discussion on how update will remove all current parameters for a given key-value pair
-- notes on default parameters being created (to try and prevent an item from becoming inoperative)
-- example usage for the ingestion of list-based values
second, append/remove parameters could be added to the update function to allow more fine-grained control on the simple addition/removal of values.
-- This would be a quality of life improvement to allow more pythonic operation instead of full replacement for what could be a single item addition/removal
-- The current methodology for adding a value is a bit circuitous:
list_typeKeywords=item.typeKeywordslist_typeKeywords.append("some new keyword")
text_typeKeywords=",".join(list_typeKeywords)
item.update({"typeKeywords": text_typeKeywords})
third, if the API is going to attempt to provide defaults, those ideally would match the typeKeywords generated at item creation
Platform (please complete the following information):
OS: Windows 11
VS Code
Python API Version 2.3.0.2]
The text was updated successfully, but these errors were encountered:
@FeralCatColonist
Thanks for reporting this and being so thorough in the description! Going to take a look at this and get it sorted, Ill let you know of any updates
@FeralCatColonist
I spoke with our sharing team about this behavior and they say it is expected and has always been like this... however I do see it being frustrating for apps when all the typeKeywords get eliminated and you lose functionality of that app.
We will look into an enhancement in the python code but since typeKeywords are added within the item_properties dictionary we cannot simply add an append or anything.
For now the workaround, albeit circular, is the best way to manage this occurrence. We will amp up our documentation around this as well.
Describe the bug
When providing an update to the
typeKeywords
key, if appropriate values are not provided, then a series of default values are inserted into the item'stypeKeywords
. These may be substantially different from the default values assigned during the item's creation. This can provide a number of unintended consequences, most notably with the Site Application item type where the lack of ahubsubdomain|some-site
keyword effectively removes access to the site.To Reproduce
Steps to reproduce the behavior:
error:
Expected behavior
The current documentation is lackluster for those unfamiliar with using the ArcGIS REST API, when utilizing
update
my expectation is that it appends a singular value, and wholesale replacement of the values would require a comma separated list. This erroneous thought process was compounded by the fact that items continued to operate, returned a number oftypeKeywords
including the singular value that was provided. As stated above, this behavior was not fully understood until the Site Application became inoperative.A few thoughts,
-- developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.update
-- a discussion on how
update
will remove all current parameters for a given key-value pair-- notes on default parameters being created (to try and prevent an item from becoming inoperative)
-- example usage for the ingestion of list-based values
append
/remove
parameters could be added to the update function to allow more fine-grained control on the simple addition/removal of values.-- This would be a quality of life improvement to allow more pythonic operation instead of full replacement for what could be a single item addition/removal
-- The current methodology for adding a value is a bit circuitous:
typeKeywords
generated at item creationPlatform (please complete the following information):
2.3.0.2
]The text was updated successfully, but these errors were encountered: