Skip to content

card

card

CardSearch_UnsupportedFilterError

CardSearch_UnsupportedFilterError(
    function_name: str,
    message: str,
    parent_class: str | None = None,
)

Bases: RouteError

Raised when a caller asks for a search filter that Domo's /content/v2/cards/adminsummary endpoint does not support server-side.

Raising here is deliberate: silently building a request body the API ignores makes every caller believe they got filtered results when they actually got the unfiltered set (see crew-dcs#1488).

Source code in src/crew_dcs/routes/card.py
78
79
80
81
82
83
84
85
86
87
88
def __init__(
    self,
    function_name: str,
    message: str,
    parent_class: str | None = None,
):
    super().__init__(
        message=message,
        function_name=function_name,
        parent_class=parent_class,
    )

create_card async

create_card(
    auth: DomoAuth,
    definition: dict,
    dataset_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Create a new KPI card via PUT /content/v3/cards/kpi.

Parameters:

Name Type Description Default
auth DomoAuth

DomoAuth instance

required
definition dict

Card definition dict (from KpiCardBuilder.to_dict()["definition"] or KpiDefinition.definition property)

required
dataset_id str

The dataSourceId to bind the card to

required
context RouteContext | None

Optional RouteContext

None

Returns:

Type Description
ResponseGetData

ResponseGetData with the created card's id and metadata

Source code in src/crew_dcs/routes/card.py
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def create_card(
    auth: DomoAuth,
    definition: dict,
    dataset_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Create a new KPI card via PUT /content/v3/cards/kpi.

    Args:
        auth: DomoAuth instance
        definition: Card definition dict (from KpiCardBuilder.to_dict()["definition"]
                     or KpiDefinition.definition property)
        dataset_id: The dataSourceId to bind the card to
        context: Optional RouteContext

    Returns:
        ResponseGetData with the created card's id and metadata
    """
    url = f"https://{auth.domo_instance}.domo.com/api/content/v3/cards/kpi"

    body = {
        "definition": definition,
        "dataProvider": {"dataSourceId": dataset_id},
        "variables": True,
    }

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="PUT",
        body=body,
        context=context,
    )

    if not res.is_success:
        raise CardApiError(
            res=res,
            message=f"Failed to create card: {res.response}",
        )

    return res

delete_card async

delete_card(
    auth: DomoAuth,
    card_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Delete a card via DELETE /content/v1/cards/bulk.

The bulk endpoint takes the card ids as a cardIds query parameter (comma-separated for multiple); passing a single id deletes just that card.

Parameters:

Name Type Description Default
auth DomoAuth

DomoAuth instance

required
card_id str

The id of the card to delete

required
context RouteContext | None

Optional RouteContext

None
Source code in src/crew_dcs/routes/card.py
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def delete_card(
    auth: DomoAuth,
    card_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Delete a card via DELETE /content/v1/cards/bulk.

    The bulk endpoint takes the card ids as a ``cardIds`` query parameter
    (comma-separated for multiple); passing a single id deletes just that card.

    Args:
        auth: DomoAuth instance
        card_id: The id of the card to delete
        context: Optional RouteContext
    """
    url = f"https://{auth.domo_instance}.domo.com/api/content/v1/cards/bulk"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="DELETE",
        params={"cardIds": str(card_id)},
        context=context,
    )

    if not res.is_success:
        raise CardApiError(
            res=res,
            message=f"Failed to delete card {card_id}: {res.response}",
        )

    return res

generate_body_search_cards_admin_summary

generate_body_search_cards_admin_summary(
    page_ids: list[str] | None = None,
    card_search_text: str | None = None,
    page_search_text: str | None = None,
) -> dict

Build the POST body for search_cards_admin_summary.

Parameters:

Name Type Description Default
page_ids list[str] | None

Restrict results to cards on these page ids. This is enforced server-side (verified live: a bogus id returns 0 rows, a real id returns only cards on that page).

None
card_search_text str | None

Card-title substring filter. Enforced server-side (verified live: a nonsense term returns 0 rows).

None
page_search_text str | None

Not supported by this endpoint. Domo's POST /content/v2/cards/adminsummary silently ignores every page-title search body key tried against a live instance (domo-community): pageTitleSearchText, pageSearchText, pageTitle, searchText, query -- with and without searchPages: true -- all returned the same unfiltered result set (crew-dcs#1488). Rather than build a body the API quietly drops, this raises immediately. Pass page_search_text to search_cards_admin_summary (or DomoDatacenter.get_cards_admin_summary) instead, which apply the filter client-side against each card's pageHierarchy titles.

None

Raises:

Type Description
CardSearch_UnsupportedFilterError

if page_search_text is provided.

Source code in src/crew_dcs/routes/card.py
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
def generate_body_search_cards_admin_summary(
    page_ids: list[str] | None = None,
    #  searchPages: bool = True,
    card_search_text: str | None = None,
    page_search_text: str | None = None,
) -> dict:
    """Build the POST body for ``search_cards_admin_summary``.

    Args:
        page_ids: Restrict results to cards on these page ids. This *is* enforced
            server-side (verified live: a bogus id returns 0 rows, a real id returns
            only cards on that page).
        card_search_text: Card-title substring filter. Enforced server-side (verified
            live: a nonsense term returns 0 rows).
        page_search_text: **Not supported by this endpoint.** Domo's
            ``POST /content/v2/cards/adminsummary`` silently ignores every page-title
            search body key tried against a live instance (`domo-community`):
            ``pageTitleSearchText``, ``pageSearchText``, ``pageTitle``, ``searchText``,
            ``query`` -- with and without ``searchPages: true`` -- all returned the
            same unfiltered result set (crew-dcs#1488). Rather than build a body the
            API quietly drops, this raises immediately. Pass ``page_search_text`` to
            ``search_cards_admin_summary`` (or
            ``DomoDatacenter.get_cards_admin_summary``) instead, which apply the
            filter client-side against each card's ``pageHierarchy`` titles.

    Raises:
        CardSearch_UnsupportedFilterError: if `page_search_text` is provided.
    """
    if page_search_text:
        raise CardSearch_UnsupportedFilterError(
            function_name="generate_body_search_cards_admin_summary",
            message=(
                "page_search_text is not supported by POST /content/v2/cards/"
                "adminsummary -- Domo silently ignores every page-title filter body "
                "key tested (pageTitleSearchText, pageSearchText, pageTitle, "
                "searchText, query). Pass page_search_text to "
                "search_cards_admin_summary(...) or "
                "DomoDatacenter.get_cards_admin_summary(...) instead; they filter "
                "client-side against each card's pageHierarchy titles."
            ),
        )

    body = {"ascending": True, "orderBy": "cardTitle"}

    if card_search_text:
        body.update(
            {"cardTitleSearchText": card_search_text, "includeCardTitleClause": True}
        )

    if page_ids:
        body.update({"pageIds": page_ids})

    return body

get_card_access_list async

get_card_access_list(
    auth: DomoAuth,
    card_id: str,
    is_expand_users: bool = True,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Retrieve card access list showing which users and groups have access.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object containing credentials and instance info

required
card_id str

Unique identifier for the card

required
is_expand_users bool

Whether to expand group memberships to include individual users

True
return_raw bool

Return raw API response without processing

False
context RouteContext | None

RouteContext for request configuration

None
**context_kwargs

Additional context parameters (session, debug_api, etc.)

{}

Returns:

Type Description
ResponseGetData

ResponseGetData object containing access list with users and groups

Raises:

Type Description
CardApiError

If access list retrieval fails

Source code in src/crew_dcs/routes/card.py
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_card_access_list(
    auth: DomoAuth,
    card_id: str,
    is_expand_users: bool = True,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Retrieve card access list showing which users and groups have access.

    Args:
        auth: Authentication object containing credentials and instance info
        card_id: Unique identifier for the card
        is_expand_users: Whether to expand group memberships to include individual users
        return_raw: Return raw API response without processing
        context: RouteContext for request configuration
        **context_kwargs: Additional context parameters (session, debug_api, etc.)

    Returns:
        ResponseGetData object containing access list with users and groups

    Raises:
        CardApiError: If access list retrieval fails
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/content/v1/share/accesslist/badge/{card_id}?expandUsers={is_expand_users}"

    res = await gd.get_data(
        url,
        method="GET",
        auth=auth,
        context=context,
    )

    if return_raw:
        return res

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

    return res

get_card_by_id async

get_card_by_id(
    card_id: str,
    auth: DomoAuth,
    optional_parts: (
        list[Card_OptionalParts_Enum] | str
    ) = "certification,datasources,drillPath,owners,properties,domoapp,pages",
    *,
    context: RouteContext | None = None,
    return_raw: bool = False,
    **context_kwargs
)

Retrieve a card by ID with optional parts.

Parameters:

Name Type Description Default
card_id str

The card ID to retrieve

required
auth DomoAuth

Authentication object

required
optional_parts list[Card_OptionalParts_Enum] | str

List of Card_OptionalParts_Enum values (preferred) or comma-separated string (for backward compatibility). Defaults to "certification,datasources,drillPath,owners,properties,domoapp"

Note: Enum values are preferred over strings for type safety and better IDE support.

'certification,datasources,drillPath,owners,properties,domoapp,pages'
return_raw bool

Return raw API response

False
context RouteContext | None

Optional RouteContext for request configuration

None

Returns:

Type Description

ResponseGetData object containing card data

Source code in src/crew_dcs/routes/card.py
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_card_by_id(
    card_id: str,
    auth: DomoAuth,
    optional_parts: (
        list[Card_OptionalParts_Enum] | str
    ) = "certification,datasources,drillPath,owners,properties,domoapp,pages",
    *,
    context: RouteContext | None = None,
    return_raw: bool = False,
    **context_kwargs,
):
    """Retrieve a card by ID with optional parts.

    Args:
        card_id: The card ID to retrieve
        auth: Authentication object
        optional_parts: List of Card_OptionalParts_Enum values (preferred) or comma-separated string
            (for backward compatibility). Defaults to "certification,datasources,drillPath,owners,properties,domoapp"

            **Note:** Enum values are preferred over strings for type safety and better IDE support.
        return_raw: Return raw API response
        context: Optional RouteContext for request configuration

    Returns:
        ResponseGetData object containing card data
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/content/v1/cards/"

    parts_str = dmue.normalize_optional_parts(optional_parts)
    params = {"parts": parts_str, "urns": card_id}

    res = await gd.get_data(
        auth=auth,
        method="GET",
        url=url,
        params=params,
        context=context,
    )

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

    if return_raw:
        return res

    res.response = res.response[0]

    return res

get_card_metadata async

get_card_metadata(
    auth: DomoAuth,
    card_id: str,
    optional_parts: (
        list[Card_OptionalParts_Enum] | str
    ) = "metadata,certification,datasources,owners,problems,domoapp",
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Retrieve card metadata with optional parts.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object

required
card_id str

The card ID to retrieve metadata for

required
optional_parts list[Card_OptionalParts_Enum] | str

List of Card_OptionalParts_Enum values (preferred) or comma-separated string (for backward compatibility). Defaults to "metadata,certification,datasources,owners,problems,domoapp"

Note: Enum values are preferred over strings for type safety and better IDE support.

'metadata,certification,datasources,owners,problems,domoapp'
context RouteContext | None

Optional RouteContext for request configuration

None

Returns:

Type Description
ResponseGetData

ResponseGetData object containing card metadata

Source code in src/crew_dcs/routes/card.py
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_card_metadata(
    auth: DomoAuth,
    card_id: str,
    optional_parts: (
        list[Card_OptionalParts_Enum] | str
    ) = "metadata,certification,datasources,owners,problems,domoapp",
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Retrieve card metadata with optional parts.

    Args:
        auth: Authentication object
        card_id: The card ID to retrieve metadata for
        optional_parts: List of Card_OptionalParts_Enum values (preferred) or comma-separated string
            (for backward compatibility). Defaults to "metadata,certification,datasources,owners,problems,domoapp"

            **Note:** Enum values are preferred over strings for type safety and better IDE support.
        context: Optional RouteContext for request configuration

    Returns:
        ResponseGetData object containing card metadata
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/content/v1/cards"

    parts_str = dmue.normalize_optional_parts(optional_parts)
    params = {"urns": card_id, "parts": parts_str}

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="GET",
        params=params,
        context=context,
    )

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

    if res.is_success and len(res.response) == 0:
        raise CardSearch_NotFoundError(
            card_id=card_id,
            status=res.status,
            domo_instance=auth.domo_instance,
            parent_class=context.parent_class,
            function_name="get_card_metadata",
        )

    res.response = res.response[0]

    return res

get_cards_by_ids async

get_cards_by_ids(
    card_ids: list[str],
    auth: DomoAuth,
    optional_parts: (
        list[Card_OptionalParts_Enum] | str
    ) = "metadata,certification,datasources,drillPath,owners,properties,domoapp",
    *,
    context: RouteContext | None = None,
    return_raw: bool = False,
    **context_kwargs
)

Retrieve multiple cards by ID in a single batch request.

Uses the same /api/content/v1/cards endpoint with comma-separated urns, allowing efficient batch retrieval of card metadata (including chartType).

Parameters:

Name Type Description Default
card_ids list[str]

List of card IDs to retrieve

required
auth DomoAuth

Authentication object

required
optional_parts list[Card_OptionalParts_Enum] | str

Comma-separated metadata parts or list of Card_OptionalParts_Enum. Defaults to include metadata for chartType/badge_type hydration.

'metadata,certification,datasources,drillPath,owners,properties,domoapp'
return_raw bool

Return raw API response without processing

False
context RouteContext | None

Optional RouteContext for request configuration

None

Returns:

Type Description

ResponseGetData with response as a list of card dicts

Source code in src/crew_dcs/routes/card.py
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_cards_by_ids(
    card_ids: list[str],
    auth: DomoAuth,
    optional_parts: (
        list[Card_OptionalParts_Enum] | str
    ) = "metadata,certification,datasources,drillPath,owners,properties,domoapp",
    *,
    context: RouteContext | None = None,
    return_raw: bool = False,
    **context_kwargs,
):
    """Retrieve multiple cards by ID in a single batch request.

    Uses the same /api/content/v1/cards endpoint with comma-separated urns,
    allowing efficient batch retrieval of card metadata (including chartType).

    Args:
        card_ids: List of card IDs to retrieve
        auth: Authentication object
        optional_parts: Comma-separated metadata parts or list of Card_OptionalParts_Enum.
            Defaults to include metadata for chartType/badge_type hydration.
        return_raw: Return raw API response without processing
        context: Optional RouteContext for request configuration

    Returns:
        ResponseGetData with response as a list of card dicts
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/content/v1/cards"

    parts_str = dmue.normalize_optional_parts(optional_parts)
    urns_str = ",".join(str(cid) for cid in card_ids)
    params = {"parts": parts_str, "urns": urns_str}

    res = await gd.get_data(
        auth=auth,
        method="GET",
        url=url,
        params=params,
        context=context,
    )

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

    return res

replace_card_owners async

replace_card_owners(
    auth: DomoAuth,
    card_id: str,
    owners: list[dict[str, str]],
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

REPLACES the owners of a card. Anyone not in owners loses ownership.

NOT independently proven — this rests on the endpoint shape (PUT of a whole list), not a live before/after. Treat it as a strong lead, not a fact; see AGENTS.md on claims needing a runnable proof.

The 404-for-domoapp-cards behaviour below IS proven: tests/integration/api_semantics/design_access_semantics_tests.py::test_app_cards_have_no_owner_list.

PUT-the-whole-list, not add. Named update_card_owners until it was renamed; the old name remains as a deprecated alias. To add an owner you must GET the current owners, append, and pass the merged list — see DomoCard_OwnerManager.add_owners (classes/DomoCard/manager_owner.py:152), which does that and reads back afterwards.

Note this route does NOT work for domoapp-type cards: it 404s, because app cards carry no owner list and inherit from their page and app instance.

See .agents/guides/access-and-sharing.md for the add-vs-replace table and the read-back recipe — a 200 here does not prove the write landed.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object

required
card_id str

Card ID to update

required
owners list[dict[str, str]]

List of owner dicts with keys "id" and "type" (USER/GROUP)

required
context RouteContext | None

Optional RouteContext for request configuration

None

Returns:

Type Description
ResponseGetData

ResponseGetData object containing API response

Source code in src/crew_dcs/routes/card.py
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def replace_card_owners(
    auth: DomoAuth,
    card_id: str,
    owners: list[dict[str, str]],
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """REPLACES the owners of a card. Anyone not in `owners` loses ownership.

    NOT independently proven — this rests on the endpoint shape (PUT of a whole
    list), not a live before/after. Treat it as a strong lead, not a fact; see
    AGENTS.md on claims needing a runnable proof.

    The 404-for-domoapp-cards behaviour below IS proven: `tests/integration/api_semantics/design_access_semantics_tests.py::test_app_cards_have_no_owner_list`.

    PUT-the-whole-list, not add. Named `update_card_owners` until it was
    renamed; the old name remains as a deprecated alias. To add an owner you must
    GET the current owners, append, and pass the merged list — see
    `DomoCard_OwnerManager.add_owners` (classes/DomoCard/manager_owner.py:152),
    which does that and reads back afterwards.

    Note this route does NOT work for `domoapp`-type cards: it 404s, because app
    cards carry no owner list and inherit from their page and app instance.

    See `.agents/guides/access-and-sharing.md` for the add-vs-replace table and
    the read-back recipe — a 200 here does not prove the write landed.

    Args:
        auth: Authentication object
        card_id: Card ID to update
        owners: List of owner dicts with keys "id" and "type" (USER/GROUP)
        context: Optional RouteContext for request configuration

    Returns:
        ResponseGetData object containing API response
    """
    if not owners:
        raise ValueError("owners must be a non-empty list")

    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/content/v1/cards/{card_id}/owners"
    body = owners

    res = await gd.get_data(
        auth=auth,
        method="PUT",
        url=url,
        body=body,
        context=context,
    )

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

    return res

replace_card_pages async

replace_card_pages(
    auth: DomoAuth,
    card_id: str,
    page_ids: list[str | int],
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

REPLACES the set of pages a card lives on. Omitted pages lose the card.

PUT-the-whole-list, same shape as replace_card_owners. Named update_card_pages until it was renamed — "update" read as "add" and it is not. The old name remains as a deprecated alias.

See .agents/guides/access-and-sharing.md.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object

required
card_id str

Card ID to update

required
page_ids list[str | int]

List of page IDs the card should belong to

required
context RouteContext | None

Optional RouteContext for request configuration

None

Returns:

Type Description
ResponseGetData

ResponseGetData object containing API response

Source code in src/crew_dcs/routes/card.py
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def replace_card_pages(
    auth: DomoAuth,
    card_id: str,
    page_ids: list[str | int],
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """REPLACES the set of pages a card lives on. Omitted pages lose the card.

    PUT-the-whole-list, same shape as `replace_card_owners`. Named
    `update_card_pages` until it was renamed — "update" read as "add" and it is
    not. The old name remains as a deprecated alias.

    See `.agents/guides/access-and-sharing.md`.

    Args:
        auth: Authentication object
        card_id: Card ID to update
        page_ids: List of page IDs the card should belong to
        context: Optional RouteContext for request configuration

    Returns:
        ResponseGetData object containing API response
    """
    if not page_ids:
        raise ValueError("page_ids must be a non-empty list")

    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/content/v1/cards/{card_id}/pages"
    body = [int(page_id) for page_id in page_ids]

    res = await gd.get_data(
        auth=auth,
        method="PUT",
        url=url,
        body=body,
        context=context,
    )

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

    return res

search_cards_admin_summary async

search_cards_admin_summary(
    auth: DomoAuth,
    body: dict,
    maximum: int | None = None,
    optional_parts: (
        list[Card_OptionalParts_Enum] | str
    ) = "certification,datasources,drillPath,owners,properties,domoapp",
    debug_loop: bool = False,
    wait_sleep: int = 3,
    return_raw: bool = False,
    page_search_text: str | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Search cards admin summary with optional parts.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object

required
body dict

Search body dictionary

required
maximum int | None

Maximum number of results to return

None
optional_parts list[Card_OptionalParts_Enum] | str

List of Card_OptionalParts_Enum values (preferred) or comma-separated string (for backward compatibility). Defaults to "certification,datasources,drillPath,owners,properties,domoapp"

Note: Enum values are preferred over strings for type safety and better IDE support.

'certification,datasources,drillPath,owners,properties,domoapp'
debug_loop bool

Enable loop debugging

False
wait_sleep int

Sleep time between requests

3
return_raw bool

Return raw API response

False
page_search_text str | None

Filter results to cards whose page hierarchy contains a page (or parent page) title matching this text (case-insensitive substring match).

Domo's POST /content/v2/cards/adminsummary endpoint has no server-side equivalent of this filter -- verified live against domo-community: every body-key variant tried (pageTitleSearchText, pageSearchText, pageTitle, searchText, query, with/without searchPages) was silently ignored and returned the unfiltered result set. So this filter is applied client-side, against each card's pageHierarchy entries, after fetching. Because the filter can only be applied after the full page-set is known, passing this parameter forces a full (loop_until_end) fetch before maximum truncates the filtered results -- it no longer bounds the number of raw API pages walked.

None
context RouteContext | None

Optional RouteContext for request configuration

None

Returns:

Type Description
ResponseGetData

ResponseGetData object containing card admin summaries

Source code in src/crew_dcs/routes/card.py
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def search_cards_admin_summary(
    auth: DomoAuth,
    body: dict,
    maximum: int | None = None,
    optional_parts: (
        list[Card_OptionalParts_Enum] | str
    ) = "certification,datasources,drillPath,owners,properties,domoapp",
    debug_loop: bool = False,
    wait_sleep: int = 3,
    return_raw: bool = False,
    page_search_text: str | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Search cards admin summary with optional parts.

    Args:
        auth: Authentication object
        body: Search body dictionary
        maximum: Maximum number of results to return
        optional_parts: List of Card_OptionalParts_Enum values (preferred) or comma-separated string
            (for backward compatibility). Defaults to "certification,datasources,drillPath,owners,properties,domoapp"

            **Note:** Enum values are preferred over strings for type safety and better IDE support.
        debug_loop: Enable loop debugging
        wait_sleep: Sleep time between requests
        return_raw: Return raw API response
        page_search_text: Filter results to cards whose page hierarchy contains a page
            (or parent page) title matching this text (case-insensitive substring match).

            Domo's ``POST /content/v2/cards/adminsummary`` endpoint has no server-side
            equivalent of this filter -- verified live against `domo-community`: every
            body-key variant tried (``pageTitleSearchText``, ``pageSearchText``,
            ``pageTitle``, ``searchText``, ``query``, with/without ``searchPages``) was
            silently ignored and returned the unfiltered result set. So this filter is
            applied client-side, against each card's ``pageHierarchy`` entries, after
            fetching. Because the filter can only be applied after the full page-set is
            known, passing this parameter forces a full (``loop_until_end``) fetch before
            `maximum` truncates the *filtered* results -- it no longer bounds the number
            of raw API pages walked.
        context: Optional RouteContext for request configuration

    Returns:
        ResponseGetData object containing card admin summaries
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    limit = 100
    offset = 0
    # page_search_text is a client-side filter applied after the fetch (see docstring),
    # so `maximum` cannot be used to cap the raw fetch -- doing so could truncate the
    # unfiltered set before a match later in the pages is ever seen, silently returning
    # fewer (or zero) matches than actually exist.
    loop_until_end = not maximum or bool(page_search_text)

    url = f"https://{auth.domo_instance}.domo.com/api/content/v2/cards/adminsummary"

    parts_str = dmue.normalize_optional_parts(optional_parts)
    params = {"parts": parts_str}

    offset_params = {
        "offset": "skip",
        "limit": "limit",
    }

    def arr_fn(res):
        return res.response.get("cardAdminSummaries", [])

    res = await gd.looper(
        auth=auth,
        method="POST",
        url=url,
        arr_fn=arr_fn,
        offset_params=offset_params,
        offset_params_in_body=False,
        limit=limit,
        skip=offset,
        body=body,
        maximum=None if page_search_text else maximum,
        fixed_params=params,
        debug_loop=debug_loop,
        loop_until_end=loop_until_end,
        wait_sleep=wait_sleep,
        context=context,
    )

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

    if page_search_text:
        needle = page_search_text.lower()

        def _page_hierarchy_matches(card: dict) -> bool:
            for page in card.get("pageHierarchy") or []:
                if needle in (page.get("title") or "").lower():
                    return True
                if needle in (page.get("parentPageTitle") or "").lower():
                    return True
            return False

        filtered_rows = [row for row in res.response if _page_hierarchy_matches(row)]

        if maximum:
            filtered_rows = filtered_rows[:maximum]

        res.response = filtered_rows

    return res

update_card_owners async

update_card_owners(
    auth: DomoAuth,
    card_id: str,
    owners: list[dict[str, str]],
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Deprecated alias for replace_card_owners, which REPLACES.

Source code in src/crew_dcs/routes/card.py
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
async def update_card_owners(
    auth: DomoAuth,
    card_id: str,
    owners: list[dict[str, str]],
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Deprecated alias for `replace_card_owners`, which REPLACES."""
    warnings.warn(
        "update_card_owners is deprecated; use replace_card_owners instead. It "
        "REPLACES the card's owner list — anyone omitted from `owners` loses "
        "ownership.",
        DeprecationWarning,
        stacklevel=2,
    )
    return await replace_card_owners(
        auth=auth, card_id=card_id, owners=owners, context=context, **context_kwargs
    )

update_card_pages async

update_card_pages(
    auth: DomoAuth,
    card_id: str,
    page_ids: list[str | int],
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Deprecated alias for replace_card_pages, which REPLACES.

Source code in src/crew_dcs/routes/card.py
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
async def update_card_pages(
    auth: DomoAuth,
    card_id: str,
    page_ids: list[str | int],
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Deprecated alias for `replace_card_pages`, which REPLACES."""
    warnings.warn(
        "update_card_pages is deprecated; use replace_card_pages instead. It "
        "REPLACES the card's page list — pages omitted from `page_ids` lose the "
        "card.",
        DeprecationWarning,
        stacklevel=2,
    )
    return await replace_card_pages(
        auth=auth, card_id=card_id, page_ids=page_ids, context=context, **context_kwargs
    )