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
is 50
.paging.offset
is 0
.This function requires elevated permissions and runs only on the backend and on dashboard pages.
function listDeletedDraftPosts(
options: ListDeletedDraftPostsOptions,
): Promise<ListDeletedDraftPostsResponse>;
Options for listing deleted draft posts.
import { draftPosts } from "wix-blog-backend";
export async function myListDeletedDraftPostFunction() {
try {
const deletedDraftPost = await draftPosts.listDeletedDraftPosts();
console.log(
"Successfully retrieved the following deleted draft posts:",
deletedDraftPost,
);
return deletedDraftPost;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "draftPosts": [
* {
* "_id": "425a5dca-c32d-40e6-b2d7-a8ffa3addded",
* "_createdDate": "2023-08-13T13:51:23.823Z",
* "categoryIds": [],
* "changeOrigin": "MOVE_TO_TRASH",
* "commentingEnabled": true,
* "contentId": "65af9595676f8c78e7e808e7",
* "coverMedia": {
* "custom": false,
* "displayed": true,
* "enabled": true,
* "image": "wix:image://v1/75059a_9f8cd2f1282c4dc7ae9a4bea155e2661~mv2.jpg#originWidth=602&originHeight=773"
* },
* "editedDate": "2024-01-23T10:31:49.017Z",
* "featured": false,
* "firstPublishedDate": "2023-03-22T14:16:01.200Z",
* "hashtags": [
* "vacation",
* "dream",
* "summer",
* "hashtag"
* ],
* "hasUnpublishedChanges": true,
* "language": "en",
* "media": {
* "custom": false,
* "displayed": true,
* "wixMedia": {
* "image": "wix:image://v1/75059a_9f8cd2f1282c4dc7ae9a4bea155e2661~mv2.jpg#originWidth=602&originHeight=773"
* }
* },
* "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
* "minutesToRead": 2,
* "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
* "pricingPlanIds": [],
* "relatedPostIds": [],
* "seoData": {
* "tags": []
* },
* "seoSlug": "when-expecting-expect-the-unexpected",
* "slugs": [],
* "status": "DELETED",
* "tagIds": [],
* "title": "When expecting, expect the unexpected",
* "translations": []
* },
* {
* "_id": "2b36fbd0-f87a-43ce-ad11-e73d354b0072",
* "_createdDate": "2024-01-08T16:16:29.630Z",
* "categoryIds": [],
* "changeOrigin": "MOVE_TO_TRASH",
* "commentingEnabled": true,
* "contentId": "659c2017e7b862a68364f0bd",
* "editedDate": "2024-01-08T16:21:30.639Z",
* "editingSessionId": "760338e1-3e8d-4377-8aa4-cebf0763827f",
* "featured": false,
* "hashtags": [],
* "hasUnpublishedChanges": true,
* "language": "en",
* "media": {
* "custom": false,
* "displayed": true,
* "wixMedia": {
* "image": "wix:image://v1/nsplsh_e24d88fb732446e48d71951b09c571e8~mv2.jpg/a%20man%20with%20a%20lot%20of%20tattoos%20on%20his%20chest.jpg#originWidth=3818&originHeight=4772"
* }
* },
* "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
* "minutesToRead": 1,
* "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
* "pricingPlanIds": [],
* "relatedPostIds": [],
* "seoData": {
* "settings": {
* "keywords": [],
* "preventAutoRedirect": false
* },
* "tags": []
* },
* "slugs": [],
* "status": "DELETED",
* "tagIds": [],
* "title": "When we stand together",
* "translations": []
* },
* {
* "_id": "66935097-31c5-4fab-9693-aa1b53aeea77",
* "_createdDate": "2024-01-07T08:39:26.900Z",
* "categoryIds": [],
* "changeOrigin": "MOVE_TO_TRASH",
* "commentingEnabled": true,
* "contentId": "659a6364bb866d6c2d674b4d",
* "coverMedia": {
* "custom": false,
* "displayed": true,
* "enabled": true,
* "image": "wix:image://v1/11062b_9874b9821b9a4c92a07b1349883fbc42~mv2_d_3000_4507_s_4_2.jpg#originWidth=3000&originHeight=4507"
* },
* "editedDate": "2024-01-07T08:40:08.655Z",
* "editingSessionId": "1a140780-9d07-4d18-b914-a6d69c313879",
* "featured": false,
* "hashtags": [],
* "hasUnpublishedChanges": true,
* "language": "en",
* "media": {
* "custom": false,
* "displayed": true,
* "wixMedia": {
* "image": "wix:image://v1/11062b_9874b9821b9a4c92a07b1349883fbc42~mv2_d_3000_4507_s_4_2.jpg#originWidth=3000&originHeight=4507"
* }
* },
* "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
* "minutesToRead": 1,
* "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
* "pricingPlanIds": [],
* "relatedPostIds": [],
* "seoData": {
* "tags": []
* },
* "slugs": [],
* "status": "DELETED",
* "tagIds": [],
* "title": "This is a draft",
* "translations": []
* }
* ],
* "metaData": {
* "count": 3,
* "offset": 0,
* "total": 3
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.