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
= "e3155944-f997-4af5-9f6a-2fe8524be7f3"
GUID
= connect.Client()
client = client.content.get(GUID)
content = content.oauth.associations.find() associations
The results can be transformed into a DataFrame for easy viewing and filtering.
>>> import polars as pl
>>> pl.DataFrame(associations)
1, 6)
shape: (
┌─────────────────────────────────┬─────────────────────────────────┬────────────────────────┬───────────────────────────────┬────────────────────────────┬──────────────────────┐
│ app_guid ┆ oauth_integration_guid ┆ oauth_integration_name ┆ oauth_integration_description ┆ oauth_integration_template ┆ created_time │--- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ str ┆ str ┆ str │
│
╞═════════════════════════════════╪═════════════════════════════════╪════════════════════════╪═══════════════════════════════╪════════════════════════════╪══════════════════════╡-f997-4af5-9f6a-2fe852… ┆ 84f0f0ae-e328-44b0-98ba-aee6e7… ┆ Azure ┆ Azure (staging) ┆ azure ┆ 2024-07-17T21:13:21Z │
│ e3155944 └─────────────────────────────────┴─────────────────────────────────┴────────────────────────┴───────────────────────────────┴────────────────────────────┴──────────────────────┘
Get the content item’s guid, then use the connectapi
client to make a direct call to the associations endpoint.
library(connectapi)
<- "e3155944-f997-4af5-9f6a-2fe8524be7f3"
GUID
<- connect()
client <- client$GET(paste0("v1/content/", GUID, "/oauth/integrations/associations")) 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
- 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.