Card Routes

auth = dmda.DomoTokenAuth(
    domo_instance=os.environ['DOMO_INSTANCE'],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)

CARD_ID = 1766265020

source

CardSearch_NotFoundError

 CardSearch_NotFoundError (card_id, domo_instance, function_name, status,
                           parent_class:str=None, message=None)

base exception

Exported source
class Cards_API_Exception(de.DomoError):
    def __init__(self, res, message=None):

        super().__init__(res=res, message=message)

class CardSearch_NotFoundError(de.DomoError):
    def __init__(
        self,
        card_id,
        domo_instance,
        function_name,
        status,
        parent_class: str = None,
        message=None,
    ):
        super().__init__(
            status=status,
            message=message or f"card {card_id} not found",
            domo_instance=domo_instance,
            function_name=function_name,
            parent_class=parent_class,
        )

source

Cards_API_Exception

 Cards_API_Exception (res, message=None)

base exception


source

get_card_by_id

 get_card_by_id (card_id, auth:domolibrary.client.DomoAuth.DomoAuth, optio
                 nal_parts='certification,datasources,drillPath,owners,pro
                 perties,domoapp', debug_api:bool=False,
                 debug_num_stacks_to_drop=1,
                 session:httpx.AsyncClient=None, parent_class:str=None,
                 return_raw:bool=False)
Exported source
@gd.route_function
async def get_card_by_id(
    card_id,
    auth: dmda.DomoAuth,
    optional_parts="certification,datasources,drillPath,owners,properties,domoapp",
    debug_api: bool = False,
    debug_num_stacks_to_drop = 1,
    session : httpx.AsyncClient = None,
    parent_class :str = None,
    return_raw: bool = False,
):
    url = f"https://{auth.domo_instance}.domo.com/api/content/v1/cards/"

    params = {"parts": optional_parts, "urns": card_id}

    res = await gd.get_data(
        auth=auth,
        method="GET",
        url=url,
        session = session,
        num_stacks_to_drop = debug_num_stacks_to_drop,
        parent_class= parent_class,
        debug_api=debug_api,
        params=params,
    )

    if not res.is_success:
        raise Cards_API_Exception(res=res)

    if return_raw:
        return res

    res.response = res.response[0]

    return res
(await get_card_by_id(card_id=CARD_ID, auth = auth)).response
{'domoapp': {'id': None},
 'drillPath': {},
 'owners': [{'id': '1893952720',
   'type': 'USER',
   'displayName': 'Jae Wilson1'}],
 'datasources': [{'dataSourceId': 'fd70d83b-38dc-40a2-9349-357ec4321d3e',
   'dataSourceName': 'Vendor Amounts Dates',
   'displayType': 'webform',
   'dataType': 'webform',
   'providerType': 'webform',
   'isSampleData': False,
   'lastUpdated': 1603767029732,
   'adc': False,
   'phase': None,
   'state': 'SUCCESS'}],
 'certification': {'state': 'NOT_CERTIFIED', 'adminCertified': False},
 'urn': '1766265020',
 'id': 1766265020,
 'type': 'kpi',
 'created': 1603811235,
 'badgeUpdated': 1603811241000,
 'creatorId': 1893952720,
 'ownerId': 1893952720,
 'description': '',
 'title': 'Vendor Amounts Dates',
 'active': True,
 'allowTableDrill': True,
 'locked': False,
 'isCurrentUserOwner': True}

source

get_kpi_definition

 get_kpi_definition (auth:domolibrary.client.DomoAuth.DomoAuth,
                     card_id:str, debug_api:bool=False,
                     session:httpx.AsyncClient=None,
                     parent_class:str=None, debug_num_stacks_to_drop=2)

sample implementation of get_card_kpi

(await get_kpi_definition(card_id=CARD_ID, auth=auth)).response
{'id': 1766265020,
 'urn': '1766265020',
 'definition': {'subscriptions': {'big_number': {'name': 'big_number',
    'columns': [{'column': 'Amount',
      'aggregation': 'SUM',
      'alias': 'Sum of Amount',
      'format': {'type': 'abbreviated', 'format': '#'}}],
    'filters': [],
    'orderBy': [],
    'groupBy': [],
    'fiscal': False,
    'projection': False,
    'distinct': False,
    'limit': 1},
   'main': {'name': 'main',
    'columns': [{'column': 'Date', 'calendar': True, 'mapping': 'ITEM'},
     {'column': 'Amount', 'aggregation': 'SUM', 'mapping': 'VALUE'},
     {'column': 'Vendor', 'mapping': 'SERIES'}],
    'filters': [],
    'dateGrain': {'column': 'Date', 'dateTimeElement': 'DAY'},
    'orderBy': [],
    'groupBy': [{'column': 'Vendor'}, {'column': 'Date', 'calendar': True}],
    'fiscal': False,
    'projection': False,
    'distinct': False}},
  'formulas': [],
  'conditionalFormats': [],
  'annotations': [],
  'slicers': [],
  'title': 'Vendor Amounts Dates',
  'description': '',
  'chartVersion': '11',
  'charts': {'main': {'component': 'main',
    'chartType': 'badge_vert_stackedbar',
    'overrides': {},
    'goal': None}},
  'allowTableDrill': True,
  'segments': {'active': [], 'definitions': []},
  'modified': 1603811241000},
 'columns': [{'id': 'Date',
   'name': 'Date',
   'type': 'date',
   'isCalculation': False,
   'isAggregatable': True,
   'isEncrypted': False,
   'hidden': False,
   'order': 0,
   'sourceId': 'fd70d83b-38dc-40a2-9349-357ec4321d3e'},
  {'id': 'Vendor',
   'name': 'Vendor',
   'type': 'string',
   'isCalculation': False,
   'isAggregatable': True,
   'isEncrypted': False,
   'hidden': False,
   'order': 0,
   'sourceId': 'fd70d83b-38dc-40a2-9349-357ec4321d3e'},
  {'id': 'Amount',
   'name': 'Amount',
   'type': 'numeric',
   'isCalculation': False,
   'isAggregatable': True,
   'isEncrypted': False,
   'hidden': False,
   'order': 0,
   'sourceId': 'fd70d83b-38dc-40a2-9349-357ec4321d3e'}],
 'drillpath': [],
 'embedded': False,
 'dataSourceWrite': True}

source

get_card_metadata

 get_card_metadata (auth:domolibrary.client.DomoAuth.DomoAuth,
                    card_id:str, debug_api:bool=False,
                    session:httpx.AsyncClient=None, parent_class:str=None,
                    debug_num_stacks_to_drop=1, optional_parts:Union[List[
                    __main__.Card_OptionalParts_Enum],str]='metadata,certi
                    fication,datasources,owners,problems,domoapp')

source

Card_OptionalParts_Enum

 Card_OptionalParts_Enum (value, names=None, module=None, qualname=None,
                          type=None, start=1)

An enumeration.

sample implementation of get_card_metadata

(await get_card_metadata(card_id=CARD_ID, auth=auth)).response
{'metadata': {'chartType': 'badge_vert_stackedbar',
  'chartVersion': '7',
  'currentLabel': 'Sum of Amount',
  'historyId': 'b9e50cd4-19c8-44f2-a44c-6c72bd432125',
  'allTime': '{"groupName":"Other","name":"DEFAULT","type":"Other","selected":true,"estimatedSeconds":-1,"dateLabel":"","column":"Date"}',
  'calendar': 'default',
  'columnAliases': '{}',
  'columnFormats': '{}',
  'defaultDateGrain': 'Day',
  'SummaryNumberFormat': '{"type":"number","format":"#A"}'},
 'domoapp': {'id': None},
 'owners': [{'id': '1893952720',
   'type': 'USER',
   'displayName': 'Jae Wilson1'}],
 'datasources': [{'dataSourceId': 'fd70d83b-38dc-40a2-9349-357ec4321d3e',
   'dataSourceName': 'Vendor Amounts Dates',
   'displayType': 'webform',
   'dataType': 'webform',
   'providerType': 'webform',
   'isSampleData': False,
   'lastUpdated': 1603767029732,
   'adc': False,
   'phase': None,
   'state': 'SUCCESS'}],
 'certification': {'state': 'NOT_CERTIFIED', 'adminCertified': False},
 'urn': '1766265020',
 'id': 1766265020,
 'type': 'kpi',
 'created': 1603811235,
 'badgeUpdated': 1603811241000,
 'creatorId': 1893952720,
 'ownerId': 1893952720,
 'description': '',
 'title': 'Vendor Amounts Dates',
 'active': True,
 'allowTableDrill': True,
 'locked': False,
 'isCurrentUserOwner': True}

source

generate_body_search_cards_admin_summary

 generate_body_search_cards_admin_summary (page_ids:List[str]=None,
                                           card_search_text:str=None,
                                           page_search_text:str=None)
Type Default Details
page_ids List None
card_search_text str None searchPages: bool = True,
page_search_text str None
Returns dict

source

generate_body_search_cards_only_apps_filter

 generate_body_search_cards_only_apps_filter ()

source

search_cards_admin_summary

 search_cards_admin_summary (auth:domolibrary.client.DomoAuth.DomoAuth,
                             body:dict, maximum:int=None, optional_parts:s
                             tr='certification,datasources,drillPath,owner
                             s,properties,domoapp', debug_api:bool=False,
                             debug_loop:bool=False,
                             session:httpx.AsyncClient=None,
                             wait_sleep:int=3, parent_class:str=None,
                             debug_num_stacks_to_drop:int=1)

sample implementation of search_cards_admin_summary

token_auth = dmda.DomoTokenAuth(
    domo_instance=os.environ['DOMO_INSTANCE'],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)

# body = generate_body_search_cards_admin_summary()
body =generate_body_search_cards_only_apps_filter()

print(body)

card_id = 1766265020
res = await search_cards_admin_summary(
    body=body,
    maximum=5,
    auth=token_auth,
    debug_api=False,
    debug_loop=False,
    wait_sleep=5,
)

res.response[0:5]
{'includeCardTypeClause': True, 'cardTypes': ['domoapp', 'mason', 'custom'], 'ascending': True, 'orderBy': 'cardTitle'}
[{'owners': [{'id': '1728973208',
    'type': 'USER',
    'displayName': 'Peter Shull'}],
  'id': 528432108,
  'type': 'domoapp',
  'badgeUpdated': 1711677072000,
  'title': '100 People',
  'locked': False,
  'pageHierarchy': [{'pageId': 682992709, 'title': 'LLM Testing'}]},
 {'owners': [{'id': '1950208331',
    'type': 'USER',
    'displayName': 'Justin Walsh'}],
  'id': 1325872781,
  'type': 'domoapp',
  'badgeUpdated': 1722015283000,
  'title': 'Add user and group access from one dashboard to another while maintaining second dashboard users',
  'locked': False,
  'pageHierarchy': [{'pageId': 947364112,
    'title': 'Domo Operations Functions Samples - Justin Walsh'}]},
 {'owners': [{'id': '1768567034',
    'type': 'USER',
    'displayName': 'Ashleigh Stevenson'}],
  'id': 1496872551,
  'type': 'domoapp',
  'badgeUpdated': 1725633835000,
  'title': 'AI ChatGPT Brick',
  'locked': False,
  'pageHierarchy': [{'pageId': 397911082, 'title': 'Ashleigh Stevenson'}]},
 {'owners': [{'id': '263469872', 'type': 'USER', 'displayName': 'Daniel Ha'}],
  'id': 1284766332,
  'type': 'domoapp',
  'badgeUpdated': 1710134047000,
  'title': 'AI ChatGPT Brick',
  'locked': False,
  'pageHierarchy': [{'pageId': 1167474966, 'title': 'Fenix.AI Dashboard'}]},
 {'owners': [{'id': '1728973208',
    'type': 'USER',
    'displayName': 'Peter Shull'}],
  'id': 1774801543,
  'type': 'domoapp',
  'badgeUpdated': 1721324158000,
  'title': 'AI ChatGPT Brick',
  'locked': False,
  'pageHierarchy': [{'pageId': 682992709, 'title': 'LLM Testing'}]}]