Update content via cronjob, fetch content from other site

Hi all,
I was wondering if it’s possible to populate/update my kirby content via cronjob. I’m try this because I’m pulling content from bandsintown for multiple artists. To get all the content I need todo multiple api requests on page load which is not ideal. So my idea was todo this automatically on the server side and store all the data in kirby.

Any ideas or thoughts?

Your cron job can call a script or you could call a route URL that does the content updating.

Thanks for the quick reply!
You mean call a script within the kirby installation or how would that work?
Calling a route would make sense, but would the whole updating “code block” be in the config.php then?

The best option is the route, as it allows you to use Kirby’s API.

The route does not have to contain the complete code, you can call a function in the action that does the heavy lifting. Routes can also live in a plugin file, the only difference is that you can’t use c::set() but kirby()->set()

1 Like