Select to view content in your preferred language

Backup and Restore a Dashboard (and related items)

140
0
a month ago
Labels (1)
KimOllivier
Honored Contributor

I made a mistake and deleted a featurelayer used in a dashboard. I found out in time (2 weeks) so I was able to restore it. That got me thinking. How could I back up (and restore!) my precious work? There are a few problems:

1. You can export the JSON file defining the dashboard, but that is not enough. You also need the items referenced by the dashboard. That will be a WebMap mostly. But wait... the WebMap references FeatureLayers and Tables. So there needs to be a way of making a list of dependencies that also must be backed up.

2. All the references in AGOL use item_id GIUD codes that are ReadOnly. This means that simply recreating a lost reference will not work unless it has the SAME id.

3. Trying to repair a Dashboard with the replacement item is impossible in the interactive interface. As soon as you change the source, ALL settings are removed. You may as well be starting again.

So there are no simple tools to package up a project into a zip file and store for restoration later. This means that the work is very fragile. No wonder there is a flag to avoid accidental deletion (which I overrode!)

But I am a python programmer. Surely there is a simple arcgis function or module to make this routine? Nothing that I could find. The closest is the ArcGIS Assistant which can do a bit of a hack on the JSON defining the items. So I attempted to write my own. This is harder that it seems, even with the useless help of Copilot. I had to keep correcting it for obvious lack of understanding of the JSON structure.

The first step is to get a list of item_ids referenced in the Dashboard. This is hard, you have to do a recursive search or you won't get anything, even though you know they are there somewhere. Once you get the WebMap ids you can save their JSON and move on to the FeatureLayers.

The FeatureLayers return a binary ServiceDefinition which is a rabbit hole. I just want the item_id.

Then there is the Restore process. We will need a list of all these separate file dumps to return to AGOL together with the groups, owners and permissions. I can see why there is a market for third party products.

So this is an unsolved workflow for me. Is there something I have missed? How do other people backup/restore projects on AGOL? Do you just put it in the too-hard basket?

 

0 Kudos
0 Replies