How to Get All Posts in JSON Format with Ghost Public API

by
Nistor Cristian 2
in
Tutorials

In this small and easy tutorial we are going to get all posts from a Ghost blog using Ghost Public API. We need to cover a few steps:

Enable Ghost Public API

Enable Ghost Public API from your Ghost Admin Dashboard (Dashboard -> Settings -> Labs)

Get client_id and client_secret

Get client_id and client_secret. Go to your website and View page source. You should see something like this:

<script type="text/javascript">
ghost.init({
	clientId: "ghost-frontend",
	clientSecret: "xxxxxxxxxxxx"
});
</script>

Request URL

Go to:

https://example.com/ghost/api/v0.1/posts/?include=tags&formats=plaintext&client_id=ghost-frontend&client_secret=xxxxxxxxxxxx

Replace clientId and clientSecret with data that you found in the source. Also replace example.com with your domain. The request must come from a URL that the Ghost blog recognises or the request will not be authorised.

Example:
GHOST_URL/ghost/api/v0.1/posts/?include=tags&formats=plaintext&client_id=ghost-frontend&client_secret=d9de495ef4fc

More information about Ghost Public API you can find on Public API Beta or Ghost Docs.

Get a quote

Get in touch with us and we will create a custom Ghost theme that fits your branding.

close modal
Submit