Ghost Content-Api Not Working


#1

Ghost Content-aapi V2 not working for me. showing the following error

ReferenceError: GhostContentAPI is not defined

const api = new GhostContentAPI({
  host: 'http://localhost:2368',
  key: '5aa0b27939b29ddbc13d97fb8f',
  version: 'v2'
}); 

#2

@Rubel did you follow the installation instructions? The snippet you’ve provided isn’t enough to diagnose where the problem may be as you haven’t included any information about what environment you’re trying to run in or how you’ve installed the required npm package


#3
npm install @tryghost/content-api

i install it , and in package.json file added

    "engines": {
        "ghost": ">=2.0.0",
        "ghost-api": "v2"
    },

but it not working . i got the data from const apiUrl = “http://localhost:2368/ghost/api/v2/content/posts/?key=5aa0b27939b29ddbc13d97fb8f&include=tags,authors”; also.


#4

It Works Finally By Adding The Script In default.hbs.

 <script src="https://unpkg.com/@tryghost/content-api@1.0.0/umd/content-api.min.js"></script>

closed #5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.