> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: restoreFromTrashBin(draftPostId: string) # Method package: wixBlogBackend # Method menu location: wixBlogBackend --> draftPosts --> restoreFromTrashBin # Method Link: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/restore-from-trash-bin.md # Method Description: 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. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Restore a draft post from the trash bin (export from backend code) ```javascript import { draftPosts } from 'wix-blog-backend'; import { webMethod, Permissions } from 'wix-web-module'; // Sample draftPostId value: "a128796d-6df0-4dae-9d4b-f0fc3441f42d" export const myRestoreFromTrashBinFunction = webMethod( Permissions.Admin, async (draftPostId) => { try { const restoredDraftPost = await draftPosts.restoreFromTrashBin(draftPostId); console.log('Successfully restored the following draft post:', restoredDraftPost); return restoredDraftPost; } catch (error) { console.error(error); // Handle the error } } ); /* Promise resolves to: * { * "draftPost": { * "_id": "a128796d-6df0-4dae-9d4b-f0fc3441f42d", * "_createdDate": "2024-01-09T11:43:30.710Z", * "categoryIds": [ * "c8780752-f517-4cf9-9c18-0f9a22d00926", * "2b2ccb5a-e709-45a1-8353-bb3332b91297" * ], * "changeOrigin": "RESTORE", * "commentingEnabled": true, * "contentId": "65a6449869a6e0d73c4ae0dd", * "coverMedia": { * "custom": false, * "displayed": true, * "enabled": true, * "image": "wix:image://image.jpg#originWidth=3000&originHeight=2000" * }, * "editedDate": "2024-01-16T08:55:52.829Z", * "editingSessionId": "87f1a172-1632-42ec-bccd-1c22a54ca219", * "featured": true, * "hashtags": [], * "hasUnpublishedChanges": true, * "language": "en", * "media": { * "custom": false, * "displayed": true, * "wixMedia": { * "image": "wix:image://image.jpg#originWidth=3000&originHeight=2000" * } * }, * "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "minutesToRead": 0, * "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "pricingPlanIds": [], * "relatedPostIds": [], * "seoData": { * "settings": { * "keywords": [], * "preventAutoRedirect": false * }, * "tags": [] * }, * "slugs": [], * "status": "UNPUBLISHED", * "tagIds": [ * "27f5320b-d91f-4435-9b9b-4b1d41b2ae70", * "6d2e0a31-0f5e-4de8-8fd7-e45352bdfa67" * ], * "title": "Genius Ways", * "translations": [] * } * } */ ``` ## Restore a draft post from the trash bin ```javascript import { draftPosts } from 'wix-blog-backend'; // Sample draftPostId value: "a128796d-6df0-4dae-9d4b-f0fc3441f42d" export async function myRestoreFromTrashBinFunction(draftPostId) { try { const restoredDraftPost = await draftPosts.restoreFromTrashBin(draftPostId); console.log('Successfully restored the following draft post:', restoredDraftPost); return restoredDraftPost; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "draftPost": { * "_id": "a128796d-6df0-4dae-9d4b-f0fc3441f42d", * "_createdDate": "2024-01-09T11:43:30.710Z", * "categoryIds": [ * "c8780752-f517-4cf9-9c18-0f9a22d00926", * "2b2ccb5a-e709-45a1-8353-bb3332b91297" * ], * "changeOrigin": "RESTORE", * "commentingEnabled": true, * "contentId": "65a6449869a6e0d73c4ae0dd", * "coverMedia": { * "custom": false, * "displayed": true, * "enabled": true, * "image": "wix:image://image.jpg#originWidth=3000&originHeight=2000" * }, * "editedDate": "2024-01-16T08:55:52.829Z", * "editingSessionId": "87f1a172-1632-42ec-bccd-1c22a54ca219", * "featured": true, * "hashtags": [], * "hasUnpublishedChanges": true, * "language": "en", * "media": { * "custom": false, * "displayed": true, * "wixMedia": { * "image": "wix:image://image.jpg#originWidth=3000&originHeight=2000" * } * }, * "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "minutesToRead": 0, * "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "pricingPlanIds": [], * "relatedPostIds": [], * "seoData": { * "settings": { * "keywords": [], * "preventAutoRedirect": false * }, * "tags": [] * }, * "slugs": [], * "status": "UNPUBLISHED", * "tagIds": [ * "27f5320b-d91f-4435-9b9b-4b1d41b2ae70", * "6d2e0a31-0f5e-4de8-8fd7-e45352bdfa67" * ], * "title": "Genius Ways", * "translations": [] * } * } */ ``` ---