API Query Best Practice

If we want to dynamically populate different data based on a particular page in wordpress, what’s the best way to pull this data from an external API? Would it make sense to create multiple API actions where each is loaded on it’s relevant page only? For example if I only want to display data from a single externally called data point, so I create an API action for the specific page only? And then do the same for each page that I’d like to pull data into?

If you want to display the same API data on different pages, you can use the same API endpoint. By using conditional logic at the end of the settings, you define on which pages or templates the API connection should be established.

In any case, it’s important to select only the pages where the connection is actually needed through conditional logic. Even if there is no noticeable effect on the frontend, because Bricksforge double-checks whether a connection is required, a connection will still be established in the builder (or through cached data, if available) to create the dynamic data tags.

Therefore, use the API data only where it is truly needed.