How to set up coding environment to use admin api on a site that is already built

I am trying to set up the coding environment to work with the admin API on a published site that I just got added to as an admin. When I followed the steps in the development notes I just seem to end up creating a new site and not where I can use the API. I know I need to use the content api key and the admin api key, but I am not even to a step where it makes sense to use them. I am wanting to set up a program that searches the tags for ones similar to one provided and then be able to choose which ones to merge.

I installed Ghost-CLI, and Ghost. Node, Ghost, and npm are the correct versions. What is the next step.

To use the Admin (or Content) API of any Ghost site, you technically don’t need neither of the tools you mentioned.

The developer documentation is mainly meant for developing on Ghost itself, e.g. building themes, contributing to the Ghost core, etc.

How specifically are you planning to use the API? Are you going to use a HTTP client (like Postman)? Or are you looking to integrate the Ghost API(s) into a different project?

To get started with the Admin API, I’d recommend looking specifically through the documentation, which also touches upon different methods of authentication (not quite trivial for the Admin API): Ghost Admin API Documentation

Same goes for the Content API: Ghost Content API Documentation

I was hoping to use the API to access the database and query tags to find similar ones and then replace tags on posts already made to a new standard tag. My plan is to use a HTTP client, possibly Postman if I can’t get a visual studio code environment setup.

That sounds pretty doable, yeah.

What specifically are you trying to set up in VS Code? What are you struggling with?

The initial connection to the api/database. I set up a folder experimenting on getting it linked but I think I am overcomplicating it.

Not quite sure hat exactly you’re trying to do - more details may get you better advice. But generically, if you want to talk to the API, I highly recommend looking for the AdminAPI or ContentAPI SDK, as they simplify a bunch of the process. :slight_smile:

Or if you’re trying to rewrite tags, check out gctools, which has some of that functionality built in. GitHub - TryGhost/gctools: Command line utilities for working with Ghost content

I also sell a product (Phantom Admin) that can do retagging, but if you’re comfortable on the command line, gctools is probably all you need.

1 Like