When testing Embedded analytics with Omni, the URL builder is an amazing tool. But it doesn’t support all of the extended attributes you may want to pass to produce a test url.
This is an easy API recipe using our Python SDK.
You can see the script for generating a url 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
Step 1 - Pip install the sdk
pip install omni_python_sdk
Step 2 - Fill out the script
from omni_python_sdk import OmniAPI
api = OmniAPI('<<your api key>>','https://<<your omni host>>')
response = api.generate_embed_url(
{
'contentPath': '/dashboards/example_metrics',
'externalId': 'user@example.com',
'name': 'Example (embed test user)',
'secret': '<<your embed secret>>',
'email':'user@example.com',
'groups':'["my-example-group-name","second-group"]'
}
)
print(response.json()["url"])
- A full list of parameters can be found here
- The embed secret is found under settings > embed
- You’ll need to generate an API key
- Some parameters are URL encoded
- Some parameters such as groups (shown above) need to be a string of a list / array
Step 3 - Run it!
You can take the url the script emits and paste it into an incognito browser for easy testing of attributes not covered by the URL Builder