Search.../

updateDraftPost( )

Developer Preview

Updates a specified draft post.

Syntax

function updateDraftPost(_id: string, draftPost: UpdateDraftPost, options: UpdateDraftPostOptions): Promise<DraftPost>

updateDraftPost Parameters

NAME
TYPE
DESCRIPTION
_id
string

Draft post ID.

draftPost
UpdateDraftPost

Draft Post info.

options
Optional
UpdateDraftPostOptions

Options for updating a draft post.

Returns

Updated draft post info.

Return Type:

Promise<
DraftPost
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date the draft post was first created.

_id
string

Draft post ID.

categoryIds
Array<
string
>

Category IDs of the draft post.

changeOrigin
string

Reserved for internal use.

commentingEnabled
boolean

Whether commenting on the draft post is enabled.

content
Object

Reserved for internal use.

contentId
string

Reserved for internal use.

editedDate
Date

Date the draft post was last edited.

editingSessionId
string

Reserved for internal use.

excerpt
string

Draft post excerpt.

If no excerpt has been manually set, an excerpt is automatically generated from the post's text. This can be retrieved using the GENERATED_EXCERPT fieldset.

featured
boolean

Whether the draft post is marked as featured.

firstPublishedDate
Date

Date the post was first published.

hasUnpublishedChanges
boolean

Indicates if there are changes made to the draft post that have not yet been published.

hashtags
Array<
string
>

Hashtags in the draft post.

heroImage
string

Image placed at the top of the blog page.

internalId
string

Reserved for internal use.

language
string

Language the draft post is written in.

2-letter language code in ISO 639-1 alpha-2 format.

media
Media

Post cover media.

memberId
string

Draft post owner's member ID.

minutesToRead
number

Estimated reading time of the draft post (calculated automatically).

moderationDetails
ModerationDetails

Details of the draft post in review. Only relevant to posts submitted by guest writers.

mostRecentContributorId
string

Reserved for internal use.

previewTextParagraph
number

Number of paragraphs to display in a paid content preview for non-paying users.

pricingPlanIds
Array<
string
>

Pricing plan IDs. Only relevant if a post is assigned to a specific pricing plan.

relatedPostIds
Array<
string
>

IDs of posts related to this draft post.

richContent
RichContent

Draft post rich content.

scheduledPublishDate
Date

Date the draft post is scheduled to be published.

seoData
SeoSchema

SEO data.

seoSlug
string

SEO slug.

slugs
Array<
string
>

Reserved for internal use.

status
string

Status of the draft post.

tagIds
Array<
string
>

Tag IDs the draft post is tagged with.

title
string

Draft post title.

translationId
string

ID of the draft post's translations.

All translations of a single post share the same translationId. Available only if the Multilingual app is installed.

url
string

Draft post URL preview. What the URL will look like once the post is published.

Was this helpful?

updateDraftPost example

Copy Code
1import { draftPosts } from 'wix-blog-backend';
2
3 async function updateDraftPost(id, draftPost, options) {
4 try {
5 const result = await draftPosts.updateDraftPost(id, draftPost, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13