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.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