HOW TO
Contents from a portal can be added to a different portal using ArcGIS API for Python with the add() function from the arcgis.gis.ContentManager module. Within the add() function, required parameters include the REST endpoint URL of the desired item. The REST endpoint URL is available in the following template:
http://<host name>/arcgis/rest/<ServiceName>
Retrieving the URL of all the items in a portal can be tedious when a large number of services is involved.
This article provides an automated process to retrieve the REST endpoint URLs of all feature layers or web maps in a portal using the arcgis.gis module.
import arcgis from arcgis.gis import GIS
user = "username" password = "password1" url = "https://< a portal url >" gis = GIS(url, user, password)
fcs = gis.content.search("owner:" + user, item_type="Feature Layer", max_items=10) fcs
i=0 for list in fcs: print (fcs[i].url) i=i+1
Get help from ArcGIS experts
Download the Esri Support App