Recipes
Fetch Content from an external system
What you'll build
You will learn how to use a Surface component workflow to fetch from an external API and display the returned data
1. Prerequisites
- You will need a Component Workflow in a Surface
2. Add a component
const : = async () => {
const = await ("https://meowfacts.herokuapp.com");
const { } = (await .()) as { ?: string[] };
const = ?.[0] ?? '';
return {
: {
: [
{
: "html",
: `<blockquote class="external-quote">"${}"</blockquote>`,
},
],
},
};
};
export default ;Result
The API response will be appended at the end of the HTML output.