How to get only published entities using entityService?

System Information
  • Strapi Version: 5.0.1
  • Database: Postgres
  • Node Version: 20

Hi, I am trying to get only published entities using strapi.entityService I unpublished the entry but it seems like it is returning only saved version and not the published one.
It works fine if I use strapi.query. What is the difference between these two?

    let params = {
        filters: {
            locale,
            publishedAt: { $notNull: true },
        },
        populate: '*',
    }

    let content = await strapi.entityService.findMany(contentType, params);

The data looks like this:

[
{
  "id": 1,
  "documentId": "kwk097smc85j9een8n7a48wh",
  "message": "Lorem Ipsum",
  "type": "info",
  "start": "2024-09-28T22:00:00.000Z",
  "end": null,
  "createdAt": "2024-09-30T12:09:27.860Z",
  "updatedAt": "2024-09-30T12:09:27.860Z",
  "publishedAt": null,
  "locale": "de"
  }
]

What am I doing wrong? How can I get only published entities? (strapi 5.0.1)

thanks to the new strapi documentation AI search: the key I was searching for was “status”. So:

    let params = {
        status: 'published',
        filters: {
            locale,
        },
        populate: '*',
    }