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)
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?
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).
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.
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.