Select to view content in your preferred language

Working with Local Experiences - portalURL

275
2
08-20-2024 03:36 PM
CS_IBM
by
Occasional Contributor

Greetings,
I am using the ESRI Working with Experience Builder.

I am trying to upload the local_exp (EXB web app) to AGOL.
Not transfer another EXB from Portal to AGOL.
Can this be done using new_item = local_exp.upload()??

The script is craching at the new_item = local_exp.upload(

The script is:

local_exp = WebExperience(gis = gis, path = local_path1)
#print(local_exp.datasources)

item_mapping = local_exp.datasources

### Target
target = GIS(profile=me)

### Upload
new_item = local_exp.upload(
    gis = target,
    publish = True,
    title = "v3",
    item_mapping = local_exp.datasources,
    auto_remap = True,
)
new_item


It throws an error at  portalUrl

Traceback (most recent call last):
File "C:\Users\ci000030\PycharmProjects\Defra_DEV\.venv\DEV\Upload_Local_BusinessLayers.py", line 34, in <module>
new_item = local_exp.upload(
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\apps\expbuilder\expbuilder.py", line 633, in upload
url = sources[source]["portalUrl"]
KeyError: 'portalUrl'



url = sources[source]["portalUrl"]
KeyError: 'portalUrl'

Can anyone assist to assist to find a solution?

Thanks
Clive

0 Kudos
2 Replies
AnjulPandey
Regular Contributor

@CS_IBM  Seems your portal or data source (local_exp.datasources) is not valid  . Try with item_mapping = { "dataSource_4": { "itemId" : 'f9827ea6779440d196806b84017f0c33', "portalUrl" : target.url, } } and validate portal URL . Refer this link for more details Experience-builder-workflows 

CS_IBM
by
Occasional Contributor

Hi Anujal.

I am using the Working with Local Experinces example.
I only have one profile (gis = GIS()), not three!!

I updated the item_mapping, and tried 1 and 2.

1)
item_mapping1 = {
    "dataSource_7":
    {
        "itemId" : '72fca989ae914927a6fcef80c6f51805',
        "portalUrl" : 'https://DEV.maps.arcgis.com'
    }






2)
item_mapping1 = {
    "dataSource_7":
    {
        "itemId" : '72fca989ae914927a6fcef80c6f51805',
        "portalUrl" : 'https://DEV.maps.arcgis.com',
        "url" :       'https://services.arcgis.com/DEV/arcgis/rest/services/DEV/FeatureServer'
    }


The Python code:

new_item = local_exp.upload(
    gis = gis,
    publish = True,
    title = "Uploaded Local Experience",
    item_mapping = item_mapping1,
    auto_remap = True,
)
new_item



I still get the same error message for 1 and 2??

File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\apps\expbuilder\expbuilder.py", line 633, in upload
    url = sources[source]["portalUrl"]
KeyError: 'portalUrl'


Any suggestions to resolve this??

Thanks
Clive

0 Kudos