Call a rest API from another app into a Ghost page

HI all. I would like to call a content from my NocoDB server and publish it into my Ghost blog, into a page. This is a really complex table which I intend to use data from. I could embed it but it’s not fitting my needs, since the look and feel is not customized to my Ghost blog, and i would also like to use partial data only of the NocoDB table.

Is there any tutorial that would show be the key steps for doing this. I honestly dont have any idea where to start :slight_smile:

I guest I would first need to make a custom page (by using a file and not by creating a page in the backend of Ghost). I dont know how to do it

After, I guess I will need to call the NocoDB into this page. That, i could follow some NocoDB specific or any rest API tutorial

Any help is appreciated!

You could build a custom template for your theme (this works both for posts and pages) and then load the Javascript that fetches your NocoDB API from there:

Alternatively, you can also use the HTML card in your Ghost editor and wrap your Javascript in a <script>...</script>.

Keep in mind, that calling an API client-side means that all requests are visible in the browser – including your API key, in case your endpoint isn’t public.

2 Likes

Thanks a lot Jannis. I’ve managed to create the template!

I understand that Ghost is a node.js project, so I can use php in the file, and I must rely entirely on javascript right?

Now, it’s good to know that Nocodb have various ways to use it’s rest API, including javascript.

But I dont know where to start to generate the data in my template. Do anyone have a good tutorials on how to use a rest API into a template and javascript?

From my NocoDB app, I got this code snippet, where I can choose Javascript. And also i can opt to do it with Axios, Fetch, Jquery, XHR. I dont rally know what to choose there. But after inserting this between , I dont know where to look to call data.

Anyone with guidance on this? Many thanks in advance :slight_smile: