HOW TO
Item properties and resources of a feature describe and reference the content in ArcGIS Pro, ArcGIS Online, and ArcGIS Enterprise. The properties are used in search to identify the specific items requested by the user, for example, a search using the item ID. When large amounts of data are involved, Esri recommends using Python scripts to ease the process. Identifying item properties can be done using the resources.list() function in ArcGIS API for Python. However, an empty result may be returned when the function is run on hosted items. This is expected behavior as the property details of a hosted item resides in the item's JSON.
This article describes how to use ArcGIS API for Python to access the item properties in JSON. The script provided can be run on a stand-alone .py file or in ArcGIS Notebook.
from arcgis.gis import GIS import json
gis = GIS('https://arcgis.com', '<username>', '<password>')
gis = GIS(r'https://essorg.maps.arcgis.com', client_id='<client_id>', client_secret='<client_secret>', verify_cert=False)
gis = GIS(r'https://<machine>.<domain>/<web adaptor name>/home', 'username', 'password', verify_cert=False)
item_id = "<item_id>"
items = ["<item_id_1>", "<item_id_2>", "<item_id_3>", "<item_id_4>"]
item = gis.content.get(item_id) print(json.dumps(dict(item), indent=4))
for item_id in items: item = gis.content.get(item_id) print(json.dumps(dict(item), indent=4))
item = gis.content.get(item_id) print(item["type"]) print(item["owner"]) print(item["title"]) print(item["url"])
for item_id in items: item = gis.content.get(item_id) print(item["type"]) print(item["typeKeywords"]) print(item["title"]) print(item["url"])
The following shows the full script to print all the item details for multiple items.
from arcgis.gis import GIS import json gis = GIS("https://essorg.maps.arcgis.com", client_id="bcqwu37r8uboeqsample", client_secret="c2safh3q48hrinf487cbriecbsample", verify_cert=False) items = ["cf9983q4fciuewn4b3rev983qncubwei6", "1097h13498hcunc2405bffn549"] for item_id in items: item = gis.content.get(item_id) print(json.dumps(dict(item), indent=4))
Get help from ArcGIS experts
Download the Esri Support App