Auto add card to every page
Our legal dept. is asking us to add a legal disclaimer to every page in Domo. We have hundreds of pages and this would be a nightmare to manually do and then remember to add each time a new page is added. Anyone know of a way to auto-add a card to the appendix of every dashboard?
If I solved your problem, please select "yes" above
Best Answers
-
@ColemenWilson There is a command in the Java CLI called 'restore-card' that lets you add a card to any page in Domo. You can probably script it to find new pages created and then add the card legal wants
0 -
You could try something like this in Python…
Sorry, the code doesn't want to paste into here easily. Adjust code below to what shows above.
import requests Domo API credentials client_id = 'your_client_id'
client_secret = 'your_client_secret'
access_token_url = 'https://api.domo.com/oauth/token?grant_type=client_credentials&scope=data%20audit%20user%20dashboard'
api_url_base = 'https://api.domo.com/v1/' Get access token response = requests.get(access_token_url, auth=(client_id, client_secret))
access_token = response.json()['access_token'] headers = {'Authorization': f'Bearer {access_token}'} Get list of all dashboards dashboards_response = requests.get(api_url_base + 'pages', headers=headers)
dashboards = dashboards_response.json() Card ID to be added to all dashboards card_id = 'your_card_id' for dashboard in dashboards:
dashboard_id = dashboard['id']
# Add card to dashboard
add_card_url = f'{api_url_base}pages/{dashboard_id}/cards/{card_id}'
response = requests.post(add_card_url, headers=headers)
if response.status_code == 200:
print(f'Successfully added card to dashboard {dashboard_id}')
else:
print(f'Failed to add card to dashboard {dashboard_id}: {response.content}')If you don't use Python but want to try it, message me directly and I'll explain how you can execute it from a external folder.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Answers
-
My first inclination would be to leverage the API. This wouldn't be perfect, but you could have a script that would run daily, iterate through all pages, and check if a particular card id resides on each page. If not, you could copy that card onto that page. This solution wouldn't automatically add the card at page creation, but the delay would be minimal.
David Cunningham
** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
** Did this solve your problem? Accept it as a solution! ✔️**0 -
@ColemenWilson There is a command in the Java CLI called 'restore-card' that lets you add a card to any page in Domo. You can probably script it to find new pages created and then add the card legal wants
0 -
You could try something like this in Python…
Sorry, the code doesn't want to paste into here easily. Adjust code below to what shows above.
import requests Domo API credentials client_id = 'your_client_id'
client_secret = 'your_client_secret'
access_token_url = 'https://api.domo.com/oauth/token?grant_type=client_credentials&scope=data%20audit%20user%20dashboard'
api_url_base = 'https://api.domo.com/v1/' Get access token response = requests.get(access_token_url, auth=(client_id, client_secret))
access_token = response.json()['access_token'] headers = {'Authorization': f'Bearer {access_token}'} Get list of all dashboards dashboards_response = requests.get(api_url_base + 'pages', headers=headers)
dashboards = dashboards_response.json() Card ID to be added to all dashboards card_id = 'your_card_id' for dashboard in dashboards:
dashboard_id = dashboard['id']
# Add card to dashboard
add_card_url = f'{api_url_base}pages/{dashboard_id}/cards/{card_id}'
response = requests.post(add_card_url, headers=headers)
if response.status_code == 200:
print(f'Successfully added card to dashboard {dashboard_id}')
else:
print(f'Failed to add card to dashboard {dashboard_id}: {response.content}')If you don't use Python but want to try it, message me directly and I'll explain how you can execute it from a external folder.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.4K Charting
- 709 Beast Mode
- 49 App Studio
- 39 Variables
- 667 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 44 Workflows
- 7 DomoAI
- 33 Predict
- 13 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 115 Manage
- 112 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 103 Community Announcements
- 4.8K Archive