> 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: listDraftPosts(options: ListDraftPostsOptions) # Method package: wixBlogBackend # Method menu location: wixBlogBackend --> draftPosts --> listDraftPosts # Method Link: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/list-draft-posts.md # Method Description: 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` is `50`. - `paging.offset` is `0`. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## List draft posts (export from backend code) ```javascript import { draftPosts } from 'wix-blog-backend'; import { webMethod, Permissions } from 'wix-web-module'; import { elevate } from 'wix-auth'; const elevatedListDraftPost = elevate(draftPosts.listDraftPosts); export const myListDraftPostFunction = webMethod( Permissions.Admin, async () => { try { const draftPosts = await elevatedListDraftPost(); console.log('Successfully retrieved the following draft posts:', draftPosts); return draftPosts; } catch (error) { console.error(error); // Handle the error } } ); /* Promise resolves to: * { * "draftPosts": [ * { * "_id": "57194b39-c4bc-45a6-a30d-f8e860a020b2", * "_createdDate": "2024-01-10T20:46:38.739Z", * "categoryIds": [], * "changeOrigin": "MANUAL_SAVE", * "commentingEnabled": true, * "contentId": "659f0938ca4ad1a823a0fe29", * "editingSessionId": "2e890d37-1a69-4153-9cc0-a36ea7e3d4ea", * "editedDate": "2024-01-10T21:16:53.964Z", * "featured": false, * "hashtags": [], * "hasUnpublishedChanges": true, * "language": "en", * "media": { * "custom": false, * "displayed": true, * "wixMedia": { * "image": "wix:image://v1/nsplsh_c9fb970af95242248fef3697783cd3db~mv2.jpg/Sunset%20on%20Monterosa.jpg#originWidth=3840&originHeight=5760" * } * }, * "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "minutesToRead": 7, * "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "pricingPlanIds": [], * "relatedPostIds": [], * "seoData": { * "settings": { * "keywords": [], * "preventAutoRedirect": false * }, * "tags": [] * }, * "slugs": [], * "status": "UNPUBLISHED", * "tagIds": [], * "title": "Mountain Ranger", * "translations": [] * }, * { * "_id": "d12f2ef2-c0f6-4913-b04f-aeeba2165b93", * "_createdDate": "2024-01-09T11:46:42.933Z", * "categoryIds": [], * "changeOrigin": "PUBLISH", * "commentingEnabled": true, * "contentId": "659d322302ee7b202a1745de", * "editingSessionId": "4e14aa41-ad7f-4e25-b4c4-df7144002aaf", * "editedDate": "2024-01-09T11:46:42.933Z", * "featured": true, * "firstPublishedDate": "2024-01-09T11:46:43.034Z", * "hashtags": [], * "hasUnpublishedChanges": false, * "language": "en", * "media": { * "custom": false, * "displayed": true * }, * "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "minutesToRead": 0, * "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "pricingPlanIds": [], * "relatedPostIds": [], * "seoData": { * "tags": [] * }, * "seoSlug": "rocket-man", * "slugs": [ * "rocket-man" * ], * "status": "PUBLISHED", * "tagIds": [], * "title": "Rocket Man", * "translations": [] * } * ], * "metaData": { * "count": 2, * "offset": 0, * "total": 17 * } * } */ ``` ## List draft posts using options (export from backend code) ```javascript import { draftPosts } from 'wix-blog-backend'; import { webMethod, Permissions } from 'wix-web-module'; import { elevate } from 'wix-auth'; /* Sample options value": * { * "fieldsets": ["URL"], * "language": "en", * "paging": { * "cursor": "", * "limit": 5, * "offset": 0 * }, * "sort": "EDITING_DATE_DESC", * "status": "PUBLISHED" * } */ const elevatedListDraftPost = elevate(draftPosts.listDraftPosts); export const myListDraftPostFunction = webMethod( Permissions.Admin, async (options) => { try { const draftPosts = await elevatedListDraftPost(options); console.log("Successfully retrieved the following draft posts":", draftPosts); return draftPosts; } catch (error) { console.error(error); // Handle the error } } ); /* Promise resolves to": * { * "draftPosts": [ * { * "_id": "50c86b02-e508-4426-8fcc-9538d05f4d46", * "_createdDate": "2024-01-16T10":07":25.765Z", * "categoryIds": [ * "590635d7-cc7c-48cb-970c-f8339daa1cfe", * "f2975644-ebb7-475f-baf5-5eb2b195880b", * "2b2ccb5a-e709-45a1-8353-bb3332b91297" * ], * "changeOrigin": "PUBLISH", * "commentingEnabled": true, * "contentId": "65ae303933529bcd93f5a715", * "editedDate": "2024-01-22T09":07":05.418Z", * "editingSessionId": "f0596aa9-95c8-4833-8f83-aa7ce2caa1e0", * "excerpt": "When you don"t know what to do, you gotta ask yourself...", * "featured": false, * "firstPublishedDate": "2024-01-16T10":07":25.837Z", * "hashtags": [], * "hasUnpublishedChanges": false, * "language": "en", * "media": { * "custom": false, * "displayed": true * }, * "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "minutesToRead": 0, * "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "pricingPlanIds": [], * "relatedPostIds": [ * "d655251a-74eb-467d-9beb-1962984b8d94", * "6f4d3a1e-dec6-4818-b8b0-9fb62862aa5b", * "f3b0fb3b-1a70-45d6-9a8f-cd885f0db48c" * ], * "seoData": { * "settings": { * "preventAutoRedirect": false, * "keywords": [] * }, * "tags": [] * }, * "seoSlug": "american-pie", * "slugs": [ * "american-pie" * ], * "status": "PUBLISHED", * "tagIds": [], * "title": "American Pie", * "translations": [], * "url": "https"://.wixsite.com/american-pie" * }, * { * "_id": "94t86b07-e508-4426-8fgg-9538d05y4d89", * "_createdDate": "2024-01-16T10":07":25.765Z", * "categoryIds": [ * "590635d7-cc7c-48cb-970c-f8339daa1cfe", * "f2975644-ebb7-475f-baf5-5eb2b195880b", * "2b2ccb5a-e709-45a1-8353-bb3332b91297" * ], * "changeOrigin": "PUBLISH", * "commentingEnabled": true, * "contentId": "95ge303933529bcd93f5a7837", * "editedDate": "2024-01-22T09":07":05.418Z", * "editingSessionId": "f0596aa9-95c8-4833-8f83-aa7ce2caa1e0", * "excerpt": "Why do you think it is important?", * "featured": true, * "firstPublishedDate": "2024-01-16T10":07":25.837Z", * "hashtags": [], * "hasUnpublishedChanges": false, * "language": "en", * "media": { * "custom": false, * "displayed": true * }, * "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "minutesToRead": 0, * "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "pricingPlanIds": [], * "relatedPostIds": [ * "d655251a-74eb-467d-9beb-1962984b8d94", * "6f4d3a1e-dec6-4818-b8b0-9fb62862aa5b", * "f3b0fb3b-1a70-45d6-9a8f-cd885f0db48c" * ], * "seoData": { * "settings": { * "preventAutoRedirect": false, * "keywords": [] * }, * "tags": [] * }, * "seoSlug": "whatchawannado", * "slugs": [ * "whatchawannado" * ], * "status": "PUBLISHED", * "tagIds": [], * "title": "Whatchawannado", * "translations": [], * "url": "https"://wixsite.com/post/whatchawannado" * } * ], * "metaData": { * "count": 2, * "offset": 0, * "total": 2 * } *} */ ``` ## List draft posts (dashboard page code) ```javascript import { draftPosts } from 'wix-blog-backend'; export async function myListDraftPostFunction() { try { const posts = await draftPosts.listDraftPosts(); console.log('Successfully retrieved the following draft posts:', posts); return draftPosts; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "draftPosts": [ * { * "_id": "57194b39-c4bc-45a6-a30d-f8e860a020b2", * "_createdDate": "2024-01-10T20:46:38.739Z", * "categoryIds": [], * "changeOrigin": "MANUAL_SAVE", * "commentingEnabled": true, * "contentId": "659f0938ca4ad1a823a0fe29", * "editingSessionId": "2e890d37-1a69-4153-9cc0-a36ea7e3d4ea", * "editedDate": "2024-01-10T21:16:53.964Z", * "featured": false, * "hashtags": [], * "hasUnpublishedChanges": true, * "language": "en", * "media": { * "custom": false, * "displayed": true, * "wixMedia": { * "image": "wix:image://v1/nsplsh_c9fb970af95242248fef3697783cd3db~mv2.jpg/Sunset%20on%20Monterosa.jpg#originWidth=3840&originHeight=5760" * } * }, * "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "minutesToRead": 7, * "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "pricingPlanIds": [], * "relatedPostIds": [], * "seoData": { * "settings": { * "keywords": [], * "preventAutoRedirect": false * }, * "tags": [] * }, * "slugs": [], * "status": "UNPUBLISHED", * "tagIds": [], * "title": "Mountain Ranger", * "translations": [] * }, * { * "_id": "d12f2ef2-c0f6-4913-b04f-aeeba2165b93", * "_createdDate": "2024-01-09T11:46:42.933Z", * "categoryIds": [], * "changeOrigin": "PUBLISH", * "commentingEnabled": true, * "contentId": "659d322302ee7b202a1745de", * "editingSessionId": "4e14aa41-ad7f-4e25-b4c4-df7144002aaf", * "editedDate": "2024-01-09T11:46:42.933Z", * "featured": true, * "firstPublishedDate": "2024-01-09T11:46:43.034Z", * "hashtags": [], * "hasUnpublishedChanges": false, * "language": "en", * "media": { * "custom": false, * "displayed": true * }, * "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "minutesToRead": 0, * "mostRecentContributorId": "c00e8a5c-322b-4e77-8813-002e3ea7e811", * "pricingPlanIds": [], * "relatedPostIds": [], * "seoData": { * "tags": [] * }, * "seoSlug": "rocket-man", * "slugs": [ * "rocket-man" * ], * "status": "PUBLISHED", * "tagIds": [], * "title": "Rocket Man", * "translations": [] * } * ], * "metaData": { * "count": 2, * "offset": 0, * "total": 17 * } * } */ ``` ---