Viewing All Vanity URLs
Problem
You need to list all vanity URLs in use across all content on the Connect server.
Solution
Use the GET v1/vanities
API endpoint to create a data frame of vanity URLs.
from posit import connect
import polars as pl
= connect.Client()
client
= client.get(f"/v1/vanities")
response = pl.DataFrame(response.json()) results_df
>>> results_df
┌─────────────────────────────────┬──────────────────────────────┬──────────────────────┐
│ content_guid ┆ path ┆ created_time │--- ┆ --- ┆ --- │
│ str ┆ str ┆ str │
│
╞═════════════════════════════════╪══════════════════════════════╪══════════════════════╡2f022b6b-c6e7-4500-8574-d1fb4c… ┆ /my_great_vanity_url/ ┆ 2023-08-24T18:00:46Z │
│ 578af693-e561-49e3-9943-d9350f… ┆ /vanity-2/ ┆ 2023-06-29T21:27:32Z │
│ └─────────────────────────────────┴──────────────────────────────┴──────────────────────┘
library(connectapi)
library(purrr)
<- connect()
client
<- client$GET("v1/vanities")
response <- map_dfr(response, ~.x) results_df
Example output
> results_df
# A tibble: 1,120 × 3
content_guid path created_time <chr> <chr> <chr>
1 2f022b6b-c6e7-4500-8574-d1fb4cc611db /my_great_vanity_url/ 2023-08-24T18:00:46Z
2 578af693-e561-49e3-9943-d9350f2f7f93 /vanity-2/ 2023-06-29T21:27:32Z