Contentful logo

Contentful Community

Getting Publish Status of Linked Entries

I have built a custom editor for Multiple Entries-fields. I can resolve and visualize my links using the Preview API, but I’m struggling to figure out how to get the published status for each individual linked entry.
I basically want to achieve something similiar to the default Multiple Entries editor. See image below.
How would I query the APIs in order to get this?

Example:

Hi @anders.rydman,

If you’re using the Preview API, then unfortunately there will not be a way to actually find the status of each of these items, as this API does not retrieve any property that can help you figure that out.

By default, the Preview API doesn’t return the sys.publishedAt attribute that could be used to differentiate between publishing statuses.

Instead, you should use the Management API in order to do so, as it will retrieve such attribute and the following could be achieved:

To retrieve published Entries:

spaces/<space_id>/entries?sys.publishedVersion%5Bexists%5D=true

To retrieve unpublished Entries:

spaces/<space_id>/entries?sys.publishedVersion%5Bexists%5D=false

Another thing to remember is that, in case you only want to retrieve published entries, the Delivery API can also be used for this (i.e. it doesn’t retrieve unpublished entries).

Hi, I have implemented this using the management API inside my extension, the extension performs 1 fetch getting all of the publish status-related data in one request. , however. I keep getting rate limited since there is an upper limit of 10 requests per second using the CMA. Once a few editors start working concurrently we get 429 rate limit responses from the API’s almost instantly.

Is there any smarter or recommended way of achieving the same thing?

I used this approach which is not reliant on the CMA. Even though it’s a bit of a hack.

I would always recommend to just go through the UI Extension SDK so you dont need to expose a token to the extension.

429s are ok, it will just slow down a little. Some information on the sys property to figure out state can be found here: https://www.contentful.com/developers/docs/tutorials/general/determine-entry-asset-state/