Select to view content in your preferred language

Issue with Duplicating and Updating a StoryMap Using Python

188
1
10-16-2024 06:04 AM
RobinRutten_ams
New Contributor

Hi ESRI Community,

I’m currently working on automating the creation of StoryMaps in ArcGIS Online using a Python script. My aim is to use a template StoryMap for each new project, and for each instance, automatically duplicate the template and adjust the text and data according to the project’s specifics.

I’ve written a Python script that successfully duplicates the template StoryMap and updates the underlying JSON of the duplicated StoryMap. When I inspect the duplicated item in AGO Assistant, I can see that the text and data are correctly updated as per the script.

However, the problem arises when I open the duplicated StoryMap in ArcGIS Online—the text and content are not updated visually, and it essentially still displays the original template StoryMap, despite the underlying data being adjusted correctly. It seems that the changes I make to the JSON via the script are not reflected in the front-end interface.

Here’s an outline of the code I’m using

story = StoryMap(<StorymapID>)
story.duplicate()

new_storymap_id = '<new duplicated storymap id>'

# Get the duplicated StoryMap item
storymap_item = gis.content.get(new_storymap_id)

# Retrieve and modify StoryMap data (JSON)
storymap_data = storymap_item.get_data()
storymap_data_str = json.dumps(storymap_data)

# Make some adjustments to the text
# ...

# Update the StoryMap with the modified data
storymap_item.update(data=updated_storymap_data)

Has anyone encountered this issue where updates to the StoryMap JSON are visible in AGO Assistant but not reflected in the StoryMap when viewed in the browser? Any suggestions or insights on how to ensure the text and data are updated correctly when the StoryMap is opened?

Thanks for your help!

0 Kudos
1 Reply
JakeSkinner
Esri Esteemed Contributor

Hi @RobinRutten_ams, which AGOL Assistant are you using?  I recommend the new one as it allows you to view the Item Resources:

JakeSkinner_0-1729086154439.png

I wrote some migration tools that copy a Story Map from Org to another that may be helpful.  You can take a look at the Copy Story Maps.py script to see how to update the Item Resources, and also how to publish the Story Map.