How can I automate the Dev>Production promotion process for a map-centric Experience Builder app where the Production version uses different data from the Dev version?
---
Using Python API 2.3.0, AGOL Map Viewer, and AGOL Experience Builder (not Developer Edition)
---
I'm building an Experience Builder app that will be used to view and edit a high-value dataset for my organization. We have an ecosystem in AGOL that includes both Dev and Prod versions of the data. There are multiple views and related tables of the dataset, so there are several items used in the app that have both Dev and Prod versions in our organization.
My strategy so far is to have two versions (Dev and Prod) of both the EB app and the Web Map that it consumes. I make updates in the Dev map and app, then use ArcGIS Assistant to
This ArcGIS Assistant process has worked surprisingly well. I especially like that it doesn't entail creating a new Production item every time (I don't want the EB app URL to change).
However, as the app will soon have more environment-specific data sources, I'm looking for a way to automate the process, probably using the Python API. I've spent some time trying already, but haven't found a way to do it yet. In particular, I tried
Does anyone have any suggestions on how to make this work using the Python API, or even a REST API? Or any other automation method, really.
Can you elaborate on your attempt using the arcgis.gis.Item.update() method ? How were you passing in the JSON? Were you reading from a file?
@EarlMedina Sure, here's the gist of my attempt:
agol = GIS(username=USER, password=PASS)
qa_map_item = agol.content.get(QA_MAP_ID)
prod_map_item = agol.content.get(PROD_MAP_ID)
qa_map_data = io.StringIO(json.dumps(qa_map_item.get_data()))
prod_map_item.update(item_properties={}, data=qa_map_data)
And that last line is where I get the `fileName` error
Ah, for map to map this is a simple fix:
import json
from arcgis import GIS
gis = GIS("https://www.arcgis.com", "user", "pass")
map_a_id = "iusdhjfuihjsdiojmg23423432klkklj"
map_b_id = "opo9o0pokszxcvbnmopjkwer87923459"
map_a = gis.content.get(map_a_id)
map_b = gis.content.get(map_b_id)
data = map_a.get_data()
item_properties = {"text": json.dumps(data)}
map_b.update(item_properties)