Hi all,
I’ve encountered an error fetching custom post with JavaScript API client. My function to browse all posts works well, but with api.posts.read({slug: 'welcome'});
appears to be an issue.
Console givers: GET 422 (Unprocessable Entity)
This is how the call looks like:
export async function fetchArticle(slug) {
const promise = api.posts.read(
{
slug: slug
},
{
formats: ['html', 'plaintext']
}
)
return await promise
};
And loading the page with slug “welcome” this is what I get in the console GET / XHR error:
http://localhost:2368/ghost/api/v3/content/posts/?key=b78272c3dcdc852b126455c4b7&fields=id%2C%20title%2Ccustom_excerpt%2Cfeatured%2Cfeature_image%2Cslug%2Curl%2Cpublished_at&include=tags&page=welcome
I tried to use id instead of slug, but the key each time goes to the page=
Ghost v. 4.2.1 (dev/local)
Node v. 14.16.1