Skip to content

Using Umbraco.Automate to populate content from an API

Calculating...

Populate Umbraco content from an API using Umbraco.Automate

Another Umbraco.Automate post, I'm still finding new things worth sharing.

The scenario: you have content in Umbraco that you want automatically populated with data from an external API. Here I'm using a Pokémon blog as the example.

Niche, yes — but the PokéAPI is free, requires no API keys, and returns clean JSON. Low friction for experimenting.

The Umbraco Automate Flow

flowchart TD A[Content Published<br/><small>Trigger</small>] --> B[Get Content<br/><small>getContent</small>] B --> C[HTTP Request<br/><small>httpRequest</small><br/>] C --> D[Log Message<br/><small>logMessage</small><br/>] D --> E[Update Content Property.<br/><small>updateContentProperty2</small><br/>] E --> F[Update Content Property<br/><small>updateContentProperty2</small><br/>]

When a node is published, I retrieve its content key to establish context for the published item.

Using that context, I can access node properties — in this case, the node name. Since my node is named "Pikachu", I make an HTTP request to https://pokeapi.co/api/v2/pokemon/${steps.getContent.name}, where ${} is the binding syntax. This returns a JSON object from the PokéAPI.

I've added a log step for debugging, which lets me inspect the API response before acting on it.

Once I know the response shape, I add an "Update Content Property" step. This takes the content key from the trigger and targets a property alias of pokemonImage — a property on my Pokemon document type. I pass it the binding $steps.httpsRequest.responseBody.sprites.front_default, which navigates the response body and pulls the front sprite URL. That URL is then stored as a text string in the property.

I've created a quick video to demo this flow in action on my YouTube channel.