POST

Unpublish Data Item


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retracts a published data item back to draft state.

By default, this method removes the published copy of the item and creates a draft seeded with the previously-published data. Set copyToDraft to false to remove the published item without creating a draft.

Pass the published collection ID as dataCollectionId (for example, articles).

After unpublishing, edit the resulting draft via Update Data Item or Patch Data Item with dataCollectionId set to your collection's drafts shadow (for example, articles__drafts). To put the item back live, call Publish Data Item Draft.

Notes:

  • If a pending draft already exists for the supplied dataItemId, it is silently overwritten with the previously-published data.
  • The response carries the newly-created (or overwritten) draft, not the previously-published item. When copyToDraft is false, dataItem is not returned.
  • Returns NOT_FOUND if no published item exists with the supplied dataItemId.
  • Calling this method always triggers a Data Item Deleted event on the published collection. When copyToDraft is true (the default), it also triggers a Data Item Created or Data Item Updated event on the drafts shadow collection. When copyToDraft is false, no draft is created and no events fire on the drafts shadow collection.
Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Write Data Items
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/wix-data/v2/items/unpublish

Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Event TriggersThis method triggers the following events:
Did this help?