Listing Vanity URLs
Problem
You want to list all Vanity URLs on your Connect server.
Solution
Note
Requires posit-sdk>=0.6.0
Note
This action requires administrator privileges.
Call the vanities.all
method to retrieve a list of all Vanity URLs on your Connect server.
from posit import connect
= connect.Client()
client
= client.vanities.all() vanities
Let’s use polars
to look at the vanities
object.
>>> import polars as pl
>>> pl.DataFrame(vanities)
2, 3)
shape: (
┌─────────────────────────────────┬───────────────────────────┬──────────────────────┐
│ content_guid ┆ path ┆ created_time │--- ┆ --- ┆ --- │
│ str ┆ str ┆ str │
│
╞═════════════════════════════════╪═══════════════════════════╪══════════════════════╡-d1d7-4141-918c-de5e7e… ┆ /my-dashboard/ ┆ 2024-08-01T20:44:58Z │
│ dd9a4ddc578af693-e561-49e3-9943-d9350f… ┆ /my-report/ ┆ 2023-06-29T21:27:32Z │
│ └─────────────────────────────────┴───────────────────────────┴──────────────────────┘
Use get_vanity_urls()
function to get a data frame with all vanity URLs.
library(connectapi)
<- connect()
client
<- get_vanity_urls(client) vanities
Example output
> vanities
# A tibble: 2 × 3
content_guid path created_time<chr> <chr> <dttm>
1 2f022b6b-c6e7-4500-8574-d1fb4cc611db /team-dashboard/ 2020-10-13 21:11:29
2 578af693-e561-49e3-9943-d9350f2f7f93 /streamlit/my-app/ 2023-03-01 14:12:23