Building a Kirby page with data from an API


#1

I’ve created a few pages with Kirby in the past.
Now I want to extend my skills a bit and need some tips or tutorials.

For personal use I would like to use the data from an external API.
The data should either be stored in files or pages/subpages should be generated directly in Kirby.

You can imagine the structure of the API like this:
There are tournaments. These tournaments have different competitions. At each tournament several athletes take part.

It would be nice, if you could give me some suggestions, how I can realize something like this with Kirby. Maybe you even have tutorials or posts or something similar for me.


#2

While this recipe deals with a database, the same logic can be applied to data from an API: https://getkirby.com/docs/cookbook/database/pages-from-database


#3

That’s a nice first step. Thank you.
I am grateful for any additional suggestion.


#4

https://getkirby.com/docs/cookbook/live/getkirby-com#virtual-pages

You could check out the source code of the getkirby.com website.

Note that we are dealing with virtual pages here, that do not live in the content folder.

If you really want to create pages from the API (why would you?), then Kirby’s API has the create() method to create pages in the file system.