Unable to clone a web map consisting of open data layers

1541
8
08-04-2021 04:48 AM
MariamJamilah
New Contributor III

Hello,

I am trying to clone a web map from my portal (arcgis enterprise) to AGOL account. The web map consists of layers added using the following url (https://services9.arcgis.com/RHVPKKiFTONKtxq3/arcgis/rest/services/NOAA_short_term_warnings_v1/Featu... . When I try to clone this web map, it throws as error.

I have used the following lines of code to clone the web map:

source = GIS(url=portalurl, username=username, password=password, verify_cert=False)
target = GIS(url="https://www.arcgis.com", username=username_agol, password=password_agol, verify_cert=False)
wmap = source.content.get(wmapID)
target_clone_item = target.content.clone_items([wmap])

 

The error message is as follows:

Exception: Invalid token.
Invalid token.
(Error Code: 498)

 

0 Kudos
8 Replies
MichaelVolz
Esteemed Contributor

Does the ESRI documentation say that you can clone a web map from your Portal to AGOL?  I ask because generally speaking AGOL is 2 releases ahead of Portal.

What version of Enterprise are you using for your Portal?

0 Kudos
MariamJamilah
New Contributor III

Thank you for your immediate response!

I'm not sure about the documentation part. But I'm able to clone other web maps (that is, web maps containing layers created by me) from my portal to my AGOL account.

I'm using ArcGIS Enterprise 10.9 

Also, I get the error (mentioned in the initial post) when I try to clone from one portal to another (so the error is applicable to both AGOL and Enterprise).

0 Kudos
HenryLindemann
Esri Contributor
Hi Mariam,
So the error indicates that you cannot login .
I would drop the , verify_cert=False in the AGOL connection that is not needed
target = GIS(url="https://www.arcgis.com", username="username_agol", password="password_agol")
then the username is case sensitive in python but not the AGOL so just double check that it matches the one in AGOL
0 Kudos
MariamJamilah
New Contributor III

Hello,

Thanks for your response!

I have tried dropping verify_cert and have checked my credentials as well, but I still get the same error

0 Kudos
ZacharySutherby
Esri Regular Contributor

Hello @MariamJamilah

This issue may be related to BUG-000136846 as the USA Shrot-Term Weather Warnings feature service is publicly available. The defect was closed as the clone_items() method requires admin access to the feature service in order to read the feature service's definition. Since your account don't have admin access to the feature service that is likely why the error is being returned. 

Thank you, 

Zach

Thank you,
Zach
0 Kudos
MariamJamilah
New Contributor III

Hello,

Thank you for bring this to my notice!

0 Kudos
emedina
New Contributor III

Hi Mariam,

As a workaround, if you needed your own copies of the layers to perform manipulations, you could instead initialize spatially enabled dataframes from the feature layers and try to publish your results to your portal that way.

0 Kudos
AnnaGabrielli
New Contributor II

Thank you for this reply! I l came across this same problem and found a workaround solution that I think others may find helpful! If using open data layers in an item a user wants to call clone_items() on, you can use the item_mapping property of the clone_items() function to reference the open data item. For example, if I want to clone a webmap that uses a living atlas layer the below code will work:

gis.content.clone_items(items = [webmap_id], item_mapping = {open_data_id : open_data_id})

  

0 Kudos