Ghost experimental admin API db endpoint - JSON export

So, I came across the knowledge that we can backup our blog via the JSON import/export functionality introduced in Ghost v2, I’m looking to automate this process and I know afew repos exist currently but they do not incubate my custom locally hosted instance of Ghost.

@gargol mentions here there is a endpoint in the admin API known as “db” so I went ahead and generated a JWT to give it a shot, knowing this is zero documentation on this for it’s experimental “phase”.

Whenever I call the POST request i’m welcome with:

{
"errors": [
    {
        "message": "Please select a database file to import.",
        "context": null,
        "type": "ValidationError",
        "details": null,
        "property": null,
        "help": null,
        "code": null,
        "id": "9ad46300-fdbc-11e9-8540-bb7912061736"
    }
]

}

So how can I configure my POST request to export instead of import?

You should be making a GET request, not a POST request

1 Like

I’m getting this response?

{
"errors": [
    {
        "message": "The server does not support the functionality required to fulfill the request.",
        "context": null,
        "type": "NotImplementedError",
        "details": null,
        "property": null,
        "help": null,
        "code": null,
        "id": "6e86f100-fdc6-11e9-8540-bb7912061736"
    }
]

}

It looks like that endpoint isn’t available for integrations; you’ll need to use User Authentication

Still facing the “NotImplementedError” even after verifying that my user auth cookies are in my delegated call.

Using Postman to test.

Just checking, you’re not sending the Auth header, correct? As far as I know, the export db option in the Admin interface hits that endpoint. You might compare the request you’re making with what the admin request makes and see what differs.

Here’s the logic for not implemented FWIW:

2 Likes

You legend, not including the auth header did the trick!

Thank you :pray:

1 Like