HOW TO
Users may want to share ArcGIS Experience Builder apps created using the Developer Edition to ArcGIS Online or ArcGIS Enterprise.
An alternative solution is to use the ArcGIS API for Python. The sample script provided in this article shows how to add ArcGIS Experience Builder Developer Edition apps to ArcGIS Online and ArcGIS Enterprise.
from arcgis.apps.expbuilder import WebExperience
from arcgis.gis import GIS
gis = GIS("https://example_domain/portal", "username", "password")
print("Logged in as: " + gis.properties.user.username)
local_path = 'C:/.../ExB_Dev_app_name/cdn/1/config.json'
local_exp = WebExperience(gis = gis, path = local_path)
local_exp.datasources
# To bring local Experiences to AGOL or portal, we can use WebExperience.upload()
uploaded_exp = local_exp.upload(gis = gis, publish = True, title = "Imported app from Dev Edition with custom widget")
uploaded_exp
The following steps walk through the sample code above:
from arcgis.gis import GIS
from arcgis.apps.expbuilder import WebExperience
gis = GIS("portal_URL", "username", "password")
print("Logged in as: " + gis.properties.user.username)
Sample outout:
Logged in as: username
Note: Credentials should not be hard-coded. The values provided above are for demo purposes only.

local_path = 'The_file_path_to_Experience_Builder_app/config.json' local_exp = WebExperience(gis = gis, path = local_path) local_exp.datasources
Sample output:
{'dataSource_1': {'id': 'dataSource_1',
'type': 'WEB_MAP',
'sourceLabel': 'web_map_name',
'itemId': '<itemId>',
'portalUrl': '<portal_url>'}}

uploaded_exp = local_exp.upload(gis = gis, publish = True, title = "name_for_imported_Experience_Builder_app") Uploaded_exp


Article ID: 000042450
Get help from ArcGIS experts
Start chatting now