Repeated API calls in Templater user function

What I’m trying to do

I want to retrieve information from an API call for my daily notes, and I want to minimize the number of requests.

Things I have tried

I have written a Templater function which retrieves information from an API call to an information provider. There are a number of parameters in the API response; some of them go into my daily note metadata, some go into the text body.

As it is now, for each different piece of information needed, I need to call the function. For instance:

location:
  - <% tp.user.returnLocation('lat') %>
  - <% tp.user.returnLocation('lon') %>

# <% tp.user.returnLocation('city') %>

The problem is: each function call is also one API call, and I’d like to minimize those calls. This looks like it would be a good use for a startup template, but I have been unable to discern how to preserve the information in order for subsequente user functions to use it.

Any ideas?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.