Finding Integrations Associated with Content

Problem

You want to find all integrations associated with a content item.

Solution

Get a content item and use its oauth.associations.find() method to find all associated integrations.

from posit import connect

GUID = "e3155944-f997-4af5-9f6a-2fe8524be7f3"

client = connect.Client()
content = client.content.get(GUID)
associations = content.oauth.associations.find()

The results can be transformed into a DataFrame for easy viewing and filtering.

>>> import polars as pl
>>> pl.DataFrame(associations)
shape: (1, 6)
┌─────────────────────────────────┬─────────────────────────────────┬────────────────────────┬───────────────────────────────┬────────────────────────────┬──────────────────────┐
│ app_guid                        ┆ oauth_integration_guid          ┆ oauth_integration_name ┆ oauth_integration_description ┆ oauth_integration_template ┆ created_time         │
------------------
strstrstrstrstrstr
╞═════════════════════════════════╪═════════════════════════════════╪════════════════════════╪═══════════════════════════════╪════════════════════════════╪══════════════════════╡
│ e3155944-f997-4af5-9f6a-2fe852… ┆ 84f0f0ae-e328-44b0-98ba-aee6e7… ┆ Azure                  ┆ Azure (staging)               ┆ azure                      ┆ 2024-07-17T21:13:21Z
└─────────────────────────────────┴─────────────────────────────────┴────────────────────────┴───────────────────────────────┴────────────────────────────┴──────────────────────┘

Get the content item’s guid, then use the connectapi client to make a direct call to the associations endpoint.

library(connectapi)

GUID <- "e3155944-f997-4af5-9f6a-2fe8524be7f3"

client <- connect()
associations <- client$GET(paste0("v1/content/", GUID, "/oauth/integrations/associations"))

The results can be transformed into a DataFrame for easy viewing and filtering.

> map_dfr(associations, ~.x)
# A tibble: 1 × 6
  app_guid                             oauth_integration_guid               oauth_integration_name oauth_integration_description oauth_integration_template created_time
  <chr>                                <chr>                                <chr>                  <chr>                         <chr>                      <chr>
1 e3155944-f997-4af5-9f6a-2fe8524be7f3 84f0f0ae-e328-44b0-98ba-aee6e775b5f0 Azure                  Azure (staging)               azure                      2024-07-17T21:13:21Zdocs

Discussion

The current implementation supports a single integration association to a content item.

An empty list is returned if the content item has no associations.

>>> content.oauth.associations.find()
[]
> client$GET(paste0("v1/content/", GUID, "/oauth/integrations/associations"))
list()

See also