HTTP Requests and Querystrings at end of URL

I’m building a site that requires data from an external API. I have two questions:

  1. What’s the best way/is there a way to make HTTP requests using Hugo?
  2. The API also requires me to append a querystring at the end of the URL of pages that want to render content that requires data from the API. Is there a way to do this? I see the querify function is available, but the given example is for an external URL.

Thanks.

I don’t think Hugo itself will make API calls for you. It can however read from data files and you can create them in any way you see fit.

Would calling the API via Javascript be an option?

Thanks for the reply!

Yeah I am not opposed to calling it via Javascript. So you suggest I create a data file after calling the API via JavaScript and read from that?

Any idea about the querystring at the end of URL’s?

I see two possible paths:

  1. You create a cron job to run a build script regularly and create the data files via the api.

  2. You create a javascript function that, everytime the page is loaded, queries the API and presents the results.

If you need the querystring information, then this second may be a better option.