Creating Posts via API Issue

I am running v0.3.25

I installed this through digitalocean droplet.

I’m currently having issues with the API where I’m able to fetch my posts but even when trying to create posts following the documentation, I am receiving fetched posts and status 200.

I’m doing most of my work in python so not sure if that is messing things up or if its a bigger issue

import requests
import json
import jwt
from datetime import datetime as date

# Admin API key goes here
key = 'my:key'

# Split the key into ID and SECRET
id, secret = key.split(':')

# Prepare header and payload
iat = int(date.now().timestamp())

header = {'alg': 'HS256', 'typ': 'JWT', 'kid': id}
payload = {
    'iat': iat,
    'exp': iat + 5 * 60,
    'aud': '/v3/admin/'
}

# Create the token (including decoding secret)
token = jwt.encode(payload, bytes.fromhex(secret), algorithm='HS256', headers=header)

# Make an authenticated request to create a post


headers = {'Authorization': 'Ghost {}'.format(token.decode()),
           'Content-Type': 'application/json',
           'Accept': 'application/json'
          }

data = {
    "posts": [{
        "title": "My test post",
        "html": "<p>My post content. Work in progress...</p>",
        "status": "published"
    }]
}

url = 'http://mysite.com/ghost/api/v3/admin/posts/?source=html'

response = requests.post(url, json=data, headers=headers)

response.json()

And the result is just a list of published/draft posts but not the new post.

Anyone having a similar issue or thoughts on how to fix? I’ve also tried v2 but doesn’t seem to help

Ok, it seems it’s an issue with my installation as I just tested on a new Ghost site installed through ghost.io

Any thoughts on how to debug?

Just to clarify @stusim, did you mean v3.25? v0. would a very old version of Ghost :sweat_smile: