Search.../

restoreFromTrashBin( )

Developer Preview

Restores a deleted draft post from the trash bin by the provided ID.

Description

Uses the draftPostId to restore a deleted draft post from the trash bin.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function restoreFromTrashBin(draftPostId: string): Promise<RestoreFromTrashBinResponse>

restoreFromTrashBin Parameters

NAME
TYPE
DESCRIPTION
draftPostId
string

Draft post ID.

Returns

Return Type:

Promise<
RestoreFromTrashBinResponse
>
NAME
TYPE
DESCRIPTION
draftPost
DraftPost

Restored draft post info.

Was this helpful?

restoreFromTrashBin example

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