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 │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ str ┆ str ┆ str │
╞═════════════════════════════════╪═════════════════════════════════╪════════════════════════╪═══════════════════════════════╪════════════════════════════╪══════════════════════╡
│ 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. You can use get_associations() to view data on associations, or you can use get_integrations() to get a list of integration objects directly.
library(connectapi)
GUID <- "e3155944-f997-4af5-9f6a-2fe8524be7f3"
client <- connect()
content <- content_item(client, GUID)
associations <- get_associations(content)You can transform the associations data into a data frame for ease of viewing.
> 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:21ZAlternatively, you can get a list of integration objects directly.
> get_integrations(content)
[[1]]
Integration: Azure
GUID: 84f0f0ae-e328-44b0-98ba-aee6e775b5f0
Template: azureDiscussion
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
- For more details about the data returned in this recipe, see List all OAuth integration associations for this content item in the API Reference.
- See OAuth Integrations in the User Guide to learn more about how publishers and viewers interact with OAuth integrations.
- See OAuth Integrations in the Admin Guide to for more detailed information on how to configure OAuth integrations.