Select to view content in your preferred language

Error when cloning items from one portal to another

05-28-2018 09:14 AM
New Contributor II

I am trying to copy/clone items from one portal to another. We have a QA portal and a prod portal. Since I hit dead end with the copy content script, I switched to using clone_items from the ArcGIS API for Python.

While the scripts appears to clone the items, meaning in most cases an item will appear in the Prod Portal, but unfortunately they don't always work. I am currently working on two 10.5.1 portals, but the problem seems to persist.

Failed clones - Type of file and error

  1. Feature Layer (hosted), nothing appears when the item is viewed and the table is empty
  2. MapImages - refers to the Source portal, not the target portal
  3. Vector Tile layer - refers to the Source portal, not the target portal
  4. WMS - refers to the Source portal, not the target portal

Successful clones - Type of file

  1. Web Map with services - Everything is the same as the source
  2. Service Definition - available for download
  3. Shapefile from ZIP - available for download
  4. Vector Tile package - available for download

Code used:

We would like to be able to easily transfer users content from one to the other.  Right now that only seems to be possible if we use services from ArcGIS Server, but not if the users create their own content using in ArcGIS Pro and uses MapImages. Do you guys have the same problem and how did you resolve it? 

I am not sure whether it is a Portal settings issue, or that maybe clone_items is only intended to work for certain file types?

Any help you may be able to provide is greatly appreciated!


0 Kudos
9 Replies
New Contributor III

Hi Morten Olesen‌, did you find a solution for cloning your hosted feature layers from one portal to another..?


0 Kudos
New Contributor II

Hi James Osundwa,

No, unfortunately. Apparently it is possible if you are willing to allow anonymous authentication, but unfortunately that is not an option for us.

ESRI recommends republishing everything regardless and they admit clone item and copy content doesn't always work. Our workflow would probably be something like this:


  1. Publish services to QA Server automated by python script  
  2. Create Web Map
  3. Create Web Application
  4. Test Web Application

On Prod

  1. Publish services to Prod Server automated by python script  
  2. Create New Web Map Prod 
  3. Clone Web Application from QA to Prod
  4. Insert new Prod Web Map into cloned Web Application
  5. Fix widgets in the Web Application (any widget that is dependent on a specific layer)
  6. Test
  7. Release

It is a little more work, but not too bad. In some ways I think it defeats the purpose of having both a QA and Prod Portal, you way as well share it with a small group on Prod and then release it to everyone after.

I don't know if that helps at all. Feel free to contact me if you have any other questions.


New Contributor III

Thanks for this info; very helpful indeed.

0 Kudos
New Contributor III

Hi Morten Olesen‌,  a year later has anything changed? Or have you dropped this all together.  We have the same needs, starting with the sample python, etc. Example: Copy content—Portal for ArcGIS (10.6) | ArcGIS Enterprise 

First glance shows that our layers are copying, but web maps are pointing to source portal and not the destination portal.

0 Kudos
New Contributor II

Hi Josh, 

I haven't looked into it since, so I am not sure if anything has changed. I seem to remember something similar to the behaviour you are describing. We are not using Portal much unfortunately as most clients seem to want something custom. I should look into the 10.7 features and see if they have made any improvements. 


New Contributor III

Ok, thanks for this. 

0 Kudos
Esri Notable Contributor

You'll need to update the webmaps JSON either before or after moving it over. The Python API also has samples for cloning:

Clone Portal users, groups and content | ArcGIS for Developers 

For example, in the Copy Items section, when it's checking whether it's a TEXT_BASED_ITEM_TYPE, you can check if it's a webmap and then find/replace all URLs within the webmap.

0 Kudos
New Contributor II

Is there a limitation on how many records can be cloned () in a feature layer? I've been successful cloning two features from AGOL to Portal with <1,000 records, but I get the "_ItemCreateException: ('Failed to create Feature Service..." error when attempting to "clone_content" for a layer with ~13,000 records. When I set copy_data=False I get it to Portal with no records, so I'm assuming its the record count? I am using the "content.clone_items" api module..

0 Kudos
Occasional Contributor

the api has been updated and cloning is much easier.

Clone example

It is that simple. One caveat, I am using enterprise notebook so I did not have to enter source information.