In a model where the draft/published system is enabled, Published records can subsequently be Unpublished in order to return them to Draft status.
When unpublishing a record, you can choose to either unpublish the whole record, or just some of its locales, similar to how the "Unpublish" dropdown button in the UI sidebar works.
This is the default behavior when you don't provide a request body.
This will unpublish the entire record, including all its localizations.
Do not include a request body at all — not even an empty object {}
.
(No request body)
(No request body)
(No request body)
Note that data.meta.is_published_version_valid === null
because the entire record has been unpublished.
Selective unpublishing is used when you only want to unpublish certain localizations instead of the whole record.
Please note: You can only unpublish locales that are currently published within a specific record. If you try to unpublish a record's locale that is already unpublished (i.e. in draft state) or doesn't exist in the record at all (even if the project has that locale), you will get a VALIDATION_INVALID
error on the content_in_locales
field.
Unpublishing only the "it" locale
Unpublishing only the "it" locale
Unpublishing only the "it" locale
Note that data.meta.is_published_version_valid === true
because the rest of the record is still published.
When recursive
is true
, if the record belongs to a tree-like collection, and any of the children records are published, those children records will unpublished as well. When recursive
is false
or not specified, a PUBLISHED_CHILDREN
error will occur in such cases.
Must be exactly "selective_unpublish_operation"
.
Array of locales to publish. They must be currently published in this record. To unpublish all locales, do NOT use this parameter, but instead unpublish the entire record by leaving the body blank (see example above).
["en"]
, ["en", "it"]
Returns a resource object of type item.