Unpublished Content Audit Report

Answer the Question:
  • How many content items have been left in an unpublished state on the server?

This report runs an audit of content items on your Connect server with an “unknown” app_mode. A content item can end up in this state when it fails to deploy. Content items that were last deployed over thirty days ago and remain unknown should likely be cleaned up (removed).

Step 1 - Get the report code

Step 2 - Run & Customize the report

This R Markdown report uses the /v1/content API endpoint available in Connect 1.8.6 and later. Visit the Connect API Reference documentation for more information.

Requirements: Administrator API Key

Create an .Renviron file to store your API key and Connect server URL.

Your Connect server URL is the same URL you use to access the Connect dashboard, minus the connect path. If you access the dashboard at https://rsc.company.com/connect/, the server URL is https://rsc.company.com/.

# ~/.Renviron
# The CONNECT_SERVER URL must have a trailing slash.
CONNECT_SERVER="https://rsc.company.com/"
CONNECT_API_KEY="mysupersecretapikey"

Restart your R session to pick up on the new environment variables.

Step 3 - Publish the report to Connect

If you are push-button publishing from the RStudio IDE, we recommend the selection “Publish document with source code” so that the report can be re-executed on a schedule.1

Connect deployment dialog box showing publication options

Step 4 (optional) - Set the report to update on a schedule

Automate a data refresh of your report by setting it up to run on a schedule. Open the Schedule content management pane to get started.

Read more about Scheduling in the Connect User Guide.

Back to top

Footnotes

  1. Connect will automatically provide these environment variables for you when you publish. If you are on an older version of Connect, or if this feature has been disabled by your admin, you should reference https://docs.posit.co/connect/user/api-keys/ for how to create an API key and https://docs.posit.co/connect/user/content-settings/#content-vars for how to input environment variables into the Vars pane of Connect.↩︎