Is there a way for an external API to access a pin published on a private Posit Connect server?
My company has a private Posit Connect server. I have a long block of code that imports data from one of our databases, pre-processes it, runs it through a model, and then does some post-processing. I would like to do this on a schedule. I know I can pin the model and prepare an RMarkdown document that runs my code, and I can pin the output.
The issue is I need to get the post-processed data to another application (built in Appian, for what it's worth). The developers have proposed building a web API--can pins be accessed that way? I feel this may be a simple question but I can't find a direct answer.
I’m not sure about accessing Pins outside of Python/R, however it should be possible to use https://www.rplumber.io/. Maybe create an API using plumber that grabs the pinned data, and then Appian will just call the API
You can totally do that! (Wrap the pin in a plumber API). We actually have some examples that do this with a model "router" that chooses between two models at varying probabilities / weightedness (although this one doesn't use pins):
Another way to do it is definitely to interact with the pins directly via API. It is a bit tricky to do so, but you definitely can using Connect's Server API. I don't know that we have fantastic guidance on doing this, to be honest... I suspect it would be something along the lines of:
Use an API Key with the "Authorization" header
Make sure to set a "Content URL" / "Vanity URL" (this gives you a bit of protection in case you do want to change the pin at some point, replace with an API, etc.)
Fetch the resource directly ( to get the latest )
Fetching a specific version of the pin would likely require a bit more effort to figure out the particular "variant" URL
For example, here is a pin that is on our public demo server in .rds format: