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

client = connect.Client()

vanities = client.vanities.all()

Let’s use polars to look at the vanities object.

>>> import polars as pl
>>> pl.DataFrame(vanities)
shape: (2, 3)
┌─────────────────────────────────┬───────────────────────────┬──────────────────────┐
│ content_guid                    ┆ path                      ┆ created_time         │
---------
strstrstr
╞═════════════════════════════════╪═══════════════════════════╪══════════════════════╡
│ dd9a4ddc-d1d7-4141-918c-de5e7e… ┆ /my-dashboard/2024-08-01T20:44:58Z
578af693-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)
client <- connect()

vanities <- get_vanity_urls(client)

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