Skip to main content

Deleting Vanity URLs

Problem

You want to delete the Vanity URL assigned to your Content.

Solution

Note

Requires posit-sdk>=0.6.0

Obtain the content object for your Content. In this example, we get the Content using its GUID.

from posit import connect

client = connect.Client()

CONTENT_GUID = "154bd2af-e8fa-4aa4-aab8-dcef701f4af9"

content = client.content.get(CONTENT_GUID)

Then delete the content.vanity attribute to destroy the Vanity URL.

del content.vanity

Obtain the content object for your Content. In this example, we get the Content using its GUID. Then call delete_vanity_url to delete the Vanity URL.

library(connectapi)
client <- connect()

CONTENT_GUID <- "154bd2af-e8fa-4aa4-aab8-dcef701f4af9"

content <- content_item(client, CONTENT_GUID)
delete_vanity_url(content)

A successful response prints the following output.

Posit Connect Content:
  Content GUID: 154bd2af-e8fa-4aa4-aab8-dcef701f4af9
  Content URL: https://connect.example.com/connect/#/apps/154bd2af-e8fa-4aa4-aab8-dcef701f4af9/
  Content Title: Example Content

content_item(client, guid = "154bd2af-e8fa-4aa4-aab8-dcef701f4af9")