About Draft Posts
The Draft Posts API gives site members the ability to access and manage draft blog posts. A draft post is an unpublished article written for a blog by site collaborators.
The size limit of a single draft blog post is 400KB.
Note: For translations and multilingual support, install the Wix Multilingual app.
Setup
To use the DraftPosts API, install the @wix/blog
package using npm or Yarn:
1npm install @wix/blog
or
1yarn add @wix/blog
Then import { draftPosts }
from @wix/blog
:
1import { draftPosts } from '@wix/blog'
Updates multiple draft posts.
Permission Scopes
For app development, you must have one of the following permission scopes:function bulkUpdateDraftPosts(options: BulkUpdateDraftPostsOptions): Promise<BulkUpdateDraftPostsResponse>
Creates a draft post.
The draft post's memberId
is required for third-party apps.
Permission Scopes
For app development, you must have one of the following permission scopes:function createDraftPost(draftPost: DraftPost, options: CreateDraftPostOptions): Promise<CreateDraftPostResponse>
Moves a draft post with the provided ID to the trash bin.
A published post can also be deleted by its provided draftPostId
.
The optional permanent
field enables you to delete a post permanently, bypassing the trash bin. When a draft post is deleted this way, it can't be restored.
Permission Scopes
For app development, you must have one of the following permission scopes:function deleteDraftPost(draftPostId: string, options: DeleteDraftPostOptions): Promise<void>
Gets a deleted draft post from the trash bin by the provided ID.
Uses the provided draftPostId
to retrieve a previously deleted draft post from the trash bin.
Permission Scopes
For app development, you must have one of the following permission scopes:function getDeletedDraftPost(draftPostId: string): Promise<GetDeletedDraftPostResponse>
Gets a draft post by the provided ID.
Uses the provided draftPostId
to retrieve a draft post.
Permission Scopes
For app development, you must have one of the following permission scopes:function getDraftPost(draftPostId: string, options: GetDraftPostOptions): Promise<GetDraftPostResponse>
Retrieves a list of up to 100 deleted draft posts.
List Deleted Draft Posts runs with these defaults, which you can override:
editedDate
is sorted in descending order. In this case,editedDate
implies the date the post was deleted.paging.limit
is50
.paging.offset
is0
.
Permission Scopes
For app development, you must have one of the following permission scopes:function listDeletedDraftPosts(options: ListDeletedDraftPostsOptions): Promise<ListDeletedDraftPostsResponse>
Retrieves a list of up to 100 draft posts per request.
List Draft Posts runs with these defaults, which you can override:
editedDate
is sorted in descending order.paging.limit
is50
.paging.offset
is0
.
Permission Scopes
For app development, you must have one of the following permission scopes:function listDraftPosts(options: ListDraftPostsOptions): Promise<ListDraftPostsResponse>
Publishes a specified draft post by ID. This creates a new post entity with the data from the draft post.
If the specified draft post was already published, the published post will be updated with the latest values from the draft post entity.
Permission Scopes
For app development, you must have one of the following permission scopes:function publishDraftPost(draftPostId: string): Promise<PublishDraftPostResponse>
Retrieves a list of up to 100 draft posts, given the provided paging, filtering, and sorting.
Query Draft Posts runs with these defaults, which you can override:
editedDate
is sorted inDESC
order.paging.limit
is50
.paging.offset
is0
.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
_id | eq() ,ne() ,hasSome() ,ascending() ,descending() |
title | eq() ,ne() ,startsWith() ,hasSome() ,exists() ,in() ,ascending() ,descending() |
excerpt | eq() ,ne() ,startsWith() ,hasSome() ,exists() ,in() ,ascending() ,descending() |
featured | eq() ,ne() ,ascending() ,descending() |
categoryIds | hasSome() ,hasAll() |
memberId | eq() ,ne() ,hasSome() |
hashtags | hasSome() ,hasAll() |
commentingEnabled | eq() ,ne() ,ascending() ,descending() |
minutesToRead | eq() ,ne() ,lt() ,le() ,gt() ,ge() ,in() |
tagIds | hasSome() ,hasAll() |
pricingPlanIds | hasSome() ,hasAll() |
translationId | eq() ,ne() ,exists() ,in() |
language | eq() ,ne() ,hasSome() ,exists() ,in() |
status | eq() ,ne() ,hasSome() ,exists() ,in() ,ascending() ,descending() |
hasUnpublishedChanges | eq() ,ne() ,ascending() ,descending() |
editedDate | eq() ,ne() ,lt() ,le() ,gt() ,ge() ,in() ,ascending() ,descending() |
scheduledPublishDate | eq() ,ne() ,lt() ,le() ,gt() ,ge() ,in() ,ascending() ,descending() |
Permission Scopes
For app development, you must have one of the following permission scopes:function queryDraftPosts(options: QueryDraftPostsOptions): DraftPostsQueryBuilder
Permanently deletes a draft post by the provided ID from the trash bin.
Uses the provided draftPostId
to permanently delete a draft post from the trash bin. This action is permanent and cannot be reversed.
Permission Scopes
For app development, you must have one of the following permission scopes:function removeFromTrashBin(draftPostId: string): Promise<void>
Restores a deleted draft post from the trash bin by the provided ID.
Uses the draftPostId
to restore a deleted draft post from the trash bin.
Permission Scopes
For app development, you must have one of the following permission scopes:function restoreFromTrashBin(draftPostId: string): Promise<RestoreFromTrashBinResponse>
Updates a specified draft post.
Permission Scopes
For app development, you must have one of the following permission scopes:function updateDraftPost(_id: string, draftPost: UpdateDraftPost, options: UpdateDraftPostOptions): Promise<UpdateDraftPostResponse>