Hey! I have just received the announcement about Kirby 3 being here, I’m very excited to try it out!
I’ve been looking around in the docs, but I’m wondering: does anybody have any tutorials, resources or project that you could share, for using Kirby as a headless CMS, with Vue cli or nuxt as the framework?
Recently, I’ve been creating projects using Vue/Nuxt for the templating, and fetching the content data from with WordPress Rest API using axios. I would love to see how people set up the Kirby API and get all the data using Vue templating instead of PHP. I would love to get rid of Wordpress and to use Kirby as my default CMS again
We will soon publish a Cookbook recipe, didn’t make it before the launch, unfortunately. But there are people who are already doing it so they might be willing to share their experiences.
Please use the Kirby 3 subcategories for your topics!
Same here. Heavily interested, so if anyone could share some experiences made along the way I am thankful. Otherwise I am looking forward to the cookbook recipe.
do we have to set routes for accessing the kirby api endpoint or not?
No you don’t. The api is available by default and can be disabled via config.
That said, I think you need to be authenticated to access the endpoint.
on a second thought, i think i am maybe misunderstanding the usage of APIs in this case, and can get away with using content representation altogether.
I have looked at this, but first I need a way to parse kerbytext client side in some way otherwise I can’t work with it, as there is no way I am sending HTML over a REST service. Have you thought about how to resolve this?
the way im fixing that was to set an option in the config.php to not use kirbytext but “regular” markdown. hopefully this is still possible with kirby 3.
I’ve tried to use the session-based authentification example in the docs, I can’t get it to work, I get a 403 forbidden error.
I simply want to get the pages content as json, to be able to display it in an SPA on the frontend. Basically just using the API as a headless CMS.
Is this a correct use case of Kirby’s API, or have I just misunderstood what Kirby’s API is?
Has anybody seen any snippet of code that they could share?
edit 1: With the previous comments, I’ve started to read about generating json and content representations with Kirby. Maybe this is what I was looking for instead of using the api…
The first example in the docs assumes you’re executing that code as a logged in user (at least I think it does ).
If you log in to the panel the code indeed does work.
Yes, I can confirm that you need to be logged in (i.e. authenticated) to the panel for the first example. Why that is, I don’t know, I’m sure the Kirby team will have an answer. Maybe because foremost the API is used for the Vue-based panel as of now.
I can also confirm that I cannot get the basic auth to work as described in my post earlier. I also receive a 403 error. Not sure about this one, might still be buggy. Maybe best to open an issue on Github, I’ll do that.
Maybe because foremost the API is used for the Vue-based panel as of now.
Yes, unfortunately that is what I’m thinking, it doesn’t look like it is supposed to be used on the frontend without being logged in. I was really excited to come back to Kirby after having to use WP, Prismic or others for my apps. I hope I’m wrong!