Extract/Export metadata information of entire DOMO App/Dashboard in Json/XML etc file format
I created an entire App/Dashboard end to end having lots of widgets including texts, images, layout, text, cards for visualising a particular dataset which I have created say using Database Connector/File upload
What I want to extract/export the entire Dashboard metadata out of DOMO in some file format being it in Json/XML etc.
For example metadata about the cards imported, the connector metadata details like hostname, username, password, sql query used to fetch the data from connector/table name from which data is fetched.
Metadata information about the entire layout say no of tabs, colour/text/headers used in the button etc.
Can you please tell me is there any way say REST Apis calls as I can see a few are there to export/extract the end to end dashboard page content?
Answers
-
Hopefully I can provide enough to get your started. If I were using Python, I would start with authenticating with the Domo API. Get a client id and secret id through the developer portal.
import requests Replace with your actual client ID and secret client_id = 'YOUR_CLIENT_ID'
client_secret = 'YOUR_CLIENT_SECRET' Get an access token auth_url = 'https://api.domo.com/oauth/token'
auth_response = requests.post(auth_url, data={
'grant_type': 'client_credentials',
'scope': 'data user'
}, auth=(client_id, client_secret)) access_token = auth_response.json()['access_token']Retrieve dashboard metadata something like this:
Replace with your actual dashboard ID dashboard_id = 'YOUR_DASHBOARD_ID'
dashboard_url = f'https://api.domo.com/v1/pages/{dashboard_id}' headers = {
'Authorization': f'Bearer {access_token}'
} dashboard_response = requests.get(dashboard_url, headers=headers)
dashboard_metadata = dashboard_response.json()And card metadata something like this:
cards_metadata = [] for card in dashboard_metadata['cards']:
card_id = card['id']
card_url = f'https://api.domo.com/v1/cards/{card_id}'
card_response = requests.get(card_url, headers=headers)
card_metadata = card_response.json()
cards_metadata.append(card_metadata)And dataset metadata something like this:
datasets_metadata = [] for card in cards_metadata:
for dataset in card['datasources']:
dataset_id = dataset['dataSourceId']
dataset_url = f'https://api.domo.com/v1/datasets/{dataset_id}'
dataset_response = requests.get(dataset_url, headers=headers)
dataset_metadata = dataset_response.json()
datasets_metadata.append(dataset_metadata)And collect the metadata in JSON or XML format something like this:
import json Export to JSON with open('dashboard_metadata.json', 'w') as json_file:
json.dump({
'dashboard': dashboard_metadata,
'cards': cards_metadata,
'datasets': datasets_metadata
}, json_file, indent=4) If you need XML, you can convert JSON to XML using a library like dicttoxml from dicttoxml import dicttoxml xml_data = dicttoxml({
'dashboard': dashboard_metadata,
'cards': cards_metadata,
'datasets': datasets_metadata
}) with open('dashboard_metadata.xml', 'wb') as xml_file:
xml_file.write(xml_data)** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
Hi, The card api does not seem to be working
card_url = f'https://api.domo.com/v1/cards/{card_id}'
However, I am able to list cards but not getting the individual card details using
https://api.domo.com/v1/cards/end point
There is also this post which someone had also faced the same issue
Moreover I tried Domo CLI command backup-card, from this I was able to export to json
Actually I had tried the dataset api which you suggested earlier using REST client.
This only retrieves the metadata as below
[{'id': 'bfd90908-e515-4fde-9357-c0291962610c', 'name': 'foodmart', 'description': '', 'rows': 3, 'columns': 5, 'schema': {'columns': [{'type': 'LONG', 'name': 'employee_id'}, {'type': 'STRING', 'name': 'full_name'}, {'type': 'DOUBLE', 'name': 'salary'}, {'type': 'DOUBLE', 'name': '_BATCH_ID_'}, {'type': 'DATETIME', 'name': '_BATCH_LAST_RUN_'}]}, 'owner': {'id': 1482431234, 'name': 'Ravi Kapoor'}, 'dataCurrentAt': '2024-05-23T10:08:20Z', 'createdAt': '2024-05-21T13:16:26Z', 'updatedAt': '2024-05-23T10:08:20Z', 'pdpEnabled': False, 'policies': [{'id': 2, 'type': 'open', 'name': 'All Rows', 'filters': [], 'users': [], 'virtualUsers': [], 'groups': []}]}]
This is the dataset I set it up using BigQuery Service account connector.
However, I could see the details of this dataset in the settings section in Data UI as below:
Report: Query
SqlDialect: UseStandardSql
Query: select employee_id, full_name, salary from foodmart.employee limit 3
I also needed to retrieve this as part of the datasource metadata. This information is not fetched with the datasets api.
I required the in-depth metadata of the datasource connector(On-prem/Cloud accounts) likewise in Looker I can export the query too.
Is there any way to do in DOMO?
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive