setting tags on connect using the connectapi package

I am trying to set tags programmatically on Posit Connect using the connectapi package, but cant figure out the right arguments to pass to set_content_tags

# by default connect selects api and server from environment variables
rsc <- connectapi::connect()

# get existing tags on connect, either as df or as list
df_tags_connect <- 
  rsc %>% get_tag_data()

ls_tags_connect <- 
  rsc %>% get_tags()

# select tags i want to set on a given object on connect
tags_etl_prod <- 
  ls_tags_connect %>% 
  filter_tag_tree_id(ids = "16")
#Posit Connect Tag Tree (filtered)
#└── Vertrieb
#  └── ETL
#    └── ETL-production

rsc %>% 
  connectapi::content_item("5ae2b667-3073-46aa-a663-179c4cf463c1") %>%
  set_content_tag_tree(tags_etl_prod)

#Error in set_content_tag_tree(., tags_etl_prod) : 
# cannot assign a category to an app. Please specify an additional tag level

 # it works if I doit it manually 
rsc$POST(
  path = glue::glue("v1/content/5ae2b667-3073-46aa-a663-179c4cf463c1/tags"),
  body = list(
    tag_id = as.character(31)
  )
)

What does set_content_tags expect?

Found some instructions on an article connectapi Tags • connectapi

rsc %>% 
  connectapi::content_item("5ae2b667-3073-46aa-a663-179c4cf463c1") %>%
  set_content_tags(ls_tags_connect$Vertrieb$ETL$`ETL-production`)

rsc %>% 
  connectapi::content_item("5ae2b667-3073-46aa-a663-179c4cf463c1") %>%
  set_content_tag_tree("Vertrieb", "ETL")

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.