Content Migration (move dashboards between models / connections)

You might have made a dashboard on one connection, only to make another connection / model and realize you should have built it there. Or maybe your use case is more sophisticated, like moving a dashboard between omni environments. In either case, you’re in the right place.

The Python SDK now supports the api endpoints to make content migration a piece of cake :birthday_cake: .

You can see the script for performing migration here. But we’ll walk through the setup step by step.

First, install the python SDK. You may want to create a virtual environment first.

Optional Step 0 - Create a virtual environment

Starting in a folder you’d like the script to live in. Double check you have at least python 3.9+

python -m venv ./.venv

Activate the virtual environment:

source ./.venv/bin/activate

windows instructions

Step 1 - Pip install the sdk

pip install omni_python_sdk

Step 2 - Create the script and fill out API key and Omni Host

from omni_python_sdk import OmniAPI

api_key = '<<your api key>>'
base_url = '<<your omni host>>'

# Initialize the API with your credentials
api = OmniAPI(api_key, base_url)

# retrieve the dashboard
dashboard_export = api.document_export('<<dashboard identifier>>')
# change the dashboard model id
dashboard_export.update({'baseModelId':'<< model id of new location >>'})
# import the modified document
api.document_import(dashboard_export)

Step 4 – Run it

python <<name of your script>>.py

This will download the original dashboard, change it’s model id, and re-upload it to your personal folder.

Working with multiple Omni instances:

If you need to migrate across environments, your script may look more like this:

from omni_python_sdk import OmniAPI

api_env1 = OmniAPI('<<api key 1>>','https://<<omni host 1>>')
api_env2 = OmniAPI('<<api key 2>>','https://<<omni host 2>>')

# retrieve the dashboard
dashboard_export = api_env1.document_export('<< dashboard identifier host 1 >>')
# change the dashboard model id
dashboard_export.update({'baseModelId':'<<model id in host 2>>'})
# import the modified document
api_env2.document_import(dashboard_export)