Plaintext value is empty using the API

When I make an API request and limit the return fields with fields, the plaintext value is empty.

http://localhost:2368/ghost/api/v3/content/posts/?key=85467c3d1c68865f197862c2ea&limit=all&fields=id,title,plaintext&formats=plaintext

It does return the value if I removed the fields parameters.

http://localhost:2368/ghost/api/v2/content/posts/?key=85467c3d1c68865f197862c2ea&limit=all&formats=plaintext

Ghost Version 3.1.0

Is there anything I’m missing?

Thanks

Any thoughts about this?

Just did a quick check for this and it all worked as expected for v3 Content API (note you have v2 on both of your screenshots)
Was verifying the output with the following test (added it to this suite):

    it('posts with plaintext field', function () {
        return request
            .get(localUtils.API.getApiQuery(`posts/?key=${validKey}&limit=all&fields=id,title,plaintext&formats=plaintext`))
            .set('Origin', testUtils.API.getURL())
            .expect('Content-Type', /json/)
            .expect('Cache-Control', testUtils.cacheRules.private)
            .expect(200)
            .then((res) => {
                localUtils.API.checkResponse(res.body.posts[0], 'post', null, null, ['id', 'title', 'plaintext']);
            });
    });

I tried this on the latest master.

Anything specific about the html content in posts missing the plaintext? Can’t really think of why this would not work :slight_smile:

Yes, tried it with the v3 and it is not working too.

Also, if I removed formats=plaintext and only provides the fields, plaintext and html are also empty.

http://localhost:2368/ghost/api/v3/content/posts/?key=85467c3d1c68865f197862c2ea&limit=all&fields=id,title

If I want to return only the id and html for example, the html is empty.

http://localhost:2368/ghost/api/v3/content/posts/?key=85467c3d1c68865f197862c2ea&limit=all&fields=id,html

It’s pretty hard to pinpoint the issue here :thinking: Could you try doing similar request on a new instance and if it does’t happen they try to import some of the data from your current instance?
My current thinking is:

  1. It might be something with the data
  2. There were some modifications in the code itself (did you do anything custom?
  3. Maybe something database specific? Which version are you running? Is it MySQL or SQLite?

Would be helpful if you could provide more information about the environment the instance is running in. Also try running the request using plain curl, so we can eliminate browser extension doing something strange.