Skip to content

[feat]: Support unpublish action for collection items #87

@nhannt201

Description

@nhannt201

A clear and concise description of what the feature is

Currently, the strapi/client SDK supports publishing entries, but there is no built-in method to unpublish a collection item. This feature request is to add an unpublish() method (or similar) to allow programmatically unpublishing a collection entry via the client.

Why should this feature be included?

This would enable developers to fully manage the publishing lifecycle of content directly from the frontend or admin tool, especially when integrating custom workflows or headless CMS setups. It’s a natural counterpart to the existing publish() method and essential for building a complete editorial experience.

Please provide an example for how this would work

`import { strapi } from '@strapi/client';

const strapiClient = strapi({
baseURL: 'http://localhost:1337/api',
auth: STRAPI_API_TOKEN,
});

// Unpublish an article
await strapiClient.collection('articles').unpublish('article-id');`

This API should ideally mirror the structure and usage of the existing publish() method for consistency and developer experience.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions