Skip to content

Commit

Permalink
PublicationAt breaking change (#2249)
Browse files Browse the repository at this point in the history
* Fixing the table of links in the rest api documentation

* String to specify the default behavior when creating a document

* Updating the links in the sidebar, too

* publishedAt breaking change

* Update docusaurus/docs/dev-docs/api/rest.md

* Update docusaurus/docs/dev-docs/api/rest.md

* Rename file and add it to BC list

---------

Co-authored-by: Pierre Wizla <[email protected]>
Co-authored-by: Pierre Wizla <[email protected]>
  • Loading branch information
3 people authored Oct 3, 2024
1 parent 2782479 commit 2626bdc
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docusaurus/docs/dev-docs/api/rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ In Strapi 5, a specific document is reached by its `documentId`.

Creates a document and returns its value.

By default, a document is created with a published status. To create a document as a draft, pass the [`?status=draft`](/dev-docs/api/rest/filters-locale-publication#status) query parameter.
By default, a document is created with a published status. To create a document as a draft, pass the [`status`](/dev-docs/api/rest/filters-locale-publication#status) query parameter with the value `draft` (e.g., `?status=draft`).

If the Internationalization (i18n) feature is enabled on the content-type, it's possible to use POST requests to the REST API to [create localized documents](/dev-docs/i18n#creating-a-new-localized-entry).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ You can click on the description of any breaking change in the following tables
| [The Entity Service API is deprecated and replaced by the Document Service API](/dev-docs/migration/v4-to-v5/breaking-changes/entity-service-deprecated) | Yes | 👷 Partly |
| [`documentId` should be used instead of `id` in API calls](/dev-docs/migration/v4-to-v5/breaking-changes/use-document-id) | Yes | 👷 Partly |
| [Database lifecycle hooks are triggered differently based on Document Service API methods](/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service) | Yes | No |
| [The `publicationState` parameter is not supported and replaced by `status`](/dev-docs/migration/v4-to-v5/breaking-changes/publication-state-removed) | Yes | ✅ Yes |
| [The `publishedAt` parameter is not supported and replaced by `status`](/dev-docs/migration/v4-to-v5/breaking-changes/publication-state-removed) | Yes | ✅ Yes |
| [The `publicationState` parameter is not supported and replaced by `status`](/dev-docs/migration/v4-to-v5/breaking-changes//publishedat-removed) | Yes | ✅ Yes |
| [Sorting by id is no longer possible to sort by chronological order](/dev-docs/migration/v4-to-v5/breaking-changes/sort-by-id) | Yes | ✅ Yes |
| [There is no `findPage()` method with the Document Service API](/dev-docs/migration/v4-to-v5/breaking-changes/no-find-page-in-document-service) | Yes | No |
| [Some attributes and content-types names are reserved by Strapi](/dev-docs/migration/v4-to-v5/breaking-changes/attributes-and-content-types-names-reserved) | Yes | No |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: publishedAt can't be used anymore to define the status
description: In Strapi 5, 'publishedAt' can no longer be used in Content API calls to set the status. The new status parameter can be used and accepts 2 different values, draft and published.
sidebar_label: status instead of publishedAt
displayed_sidebar: devDocsMigrationV5Sidebar
tags:
- breaking changes
- Content API
- GraphQL API
- Document Service API
- Draft & Publish
- upgrade to Strapi 5
---

import Intro from '/docs/snippets/breaking-change-page-intro.md'
import MigrationIntro from '/docs/snippets/breaking-change-page-migration-intro.md'
import YesPlugins from '/docs/snippets/breaking-change-affecting-plugins.md'
import YesCodemods from '/docs/snippets/breaking-change-handled-by-codemod.md'

# `publishedAt` is removed and replaced by `status`

In Strapi 5, the [Draft & Publish feature](/user-docs/content-manager/saving-and-publishing-content) has been reworked, and the Content API, including REST, GraphQL, and Document Service APIs accept a new `status` parameter.

<Intro />

<YesPlugins />
<YesCodemods />

## Breaking change description

<SideBySideContainer>

<SideBySideColumn>

**In Strapi v4**

`publishedAt` is used in the request body and accepts the following values:

- `null` sets an entry in draft,
- A date string (e.g., `2021-10-28T16:57:26.352Z`) sets the entry to published status.

</SideBySideColumn>

<SideBySideColumn>

**In Strapi 5**

`status` is used as a query parameter and accepts the following values:

- `draft` sets a in the draft version,
- `published` sets a in the published version.

</SideBySideColumn>

</SideBySideContainer>

## Migration

<MigrationIntro />

### Notes

* Additional information about how to use the new `status` parameter can be found in the [REST API](/dev-docs/api/rest/filters-locale-publication#status), [GraphQL API](/dev-docs/api/graphql#status), and [Document Service API](/dev-docs/api/document-service/status) documentation.

### Migration procedure

* API calls initiated from the front end (REST API, GraphQL API) that used `publishedAt` need to be manually updated.

0 comments on commit 2626bdc

Please sign in to comment.