HOW TO
The JSON of a feature service layer contains information such as the layer's geometry type, min and max scales, and spatial reference. The Python script provided in this article can be used to access the JSON of a feature service layer.
import arcgis
gis = arcgis.gis.GIS("<portal_URL>", "<username>", "<password>", verify_cert=False)
item = gis.content.get("<portal_itemID>") resturl = dict(item)["url"] layerurl = str(resturl) + "/" + str(<item_layerID>) layer = arcgis.features.FeatureLayer(layerurl)
print(layerurl+"?f=pjson") print(layer.properties)
The code block below demonstrates the full script.
import arcgis gis = arcgis.gis.GIS("https://machines.esri.com/portal", "username1", "password1", verify_cert=False) item = gis.content.get("asd651cqe84c6d51a") resturl = dict(item)["url"] layerurl = str(resturl) + "/" + str(0) layer = arcgis.features.FeatureLayer(layerurl) print(layerurl+"?f=pjson") print(layer.properties)
The JSON of the specific feature service layer is returned after running the script.
Get help from ArcGIS experts
Download the Esri Support App