> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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: bulkUpdateDraftPosts(options: BulkUpdateDraftPostsOptions)

# Method package: wixBlogBackend

# Method menu location: wixBlogBackend --> draftPosts --> bulkUpdateDraftPosts

# Method Link: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/bulk-update-draft-posts.md

# Method Description:

Updates multiple draft posts.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Bulk update 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 elevatedBulkUpdateDraftPosts = elevate(draftPosts.bulkUpdateDraftPosts)

/*  Sample options value: 
 * {
 *  "action": "UPDATE_PUBLISH",
 *  "draftPosts": [ 
 *    "draftPost": {
 *      "id": "448d1238-0072-4458-a280-bf81c2dd8af1",
 *      "title": "Hello, world"
 *     },
 *     "draftPost": {
 *       "id": "d1c6418d-322b-4976-a815-80ee35c2a5e7",
 *       "title": "Hello to you too"
 *     },
 *   ]
 * }
*/

export const myBulkUpdateDraftPosts = webMethod(
  Permissions.Anyone,
  async (options) => {
    try {
      const draftPosts = await elevatedBulkUpdateDraftPosts(options);
      console.log('Updated draft posts:', draftPosts)
      return draftPosts;
    } catch (error) {
      console.error(error);
      // Handle the error
    }
  }
);

/* Promise resolves to:
  {
    "bulkActionMetadada": {
      "totalFailures": 0,
      "totalSuccesses": 2,
      "undetailedFailures": 0
    },
    "results": [
      "item": {
        "categoryIds": [],
        "commentingEnabled": true,
        "featured": true,
        "language": "en",
        "media": {
            "custom": false,
            "displayed": true
        },
        "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
        "previewTextParagraph": 2,
        "pricingPlanIds": [],
        "relatedPostIds": [],
        "richContent": {
          "nodes": [
             {
               "type": "PARAGRAPH",
               "id": "pvirv1",
               "nodes": [
                 {
                   "type": "TEXT",
                   "id": "",
                   "nodes": [],
                   "textData": {
                     "text": "Hello world",
                     "decorations": []
                   }
                 }
               ],
               "paragraphData": {}
             }
           ],
        }
        "seoData": {
            "tags": []
        "},
        "seoSlug": "hello-world",
        "tagIds": [],
        "title": "Hello, world"
      },
      "item": {
        "categoryIds": [],
        "commentingEnabled": true,
        "featured": true,
        "language": "en",
        "media": {
            "custom": false,
            "displayed": true
        },
        "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
        "previewTextParagraph": 2,
        "pricingPlanIds": [],
        "relatedPostIds": [],
        "richContent": {
          "nodes": [
             {
               "type": "PARAGRAPH",
               "id": "pvirv1",
               "nodes": [
                 {
                   "type": "TEXT",
                   "id": "",
                   "nodes": [],
                   "textData": {
                     "text": "Hello to you too",
                     "decorations": []
                   }
                 }
               ],
               "paragraphData": {}
             }
           ],
        }
        "seoData": {
            "tags": []
        "},
        "seoSlug": "hello-to-you-too",
        "tagIds": [],
        "title": "Hello to you too"
      }
    ] 
  }
*/
```

## Bulk update draft posts 

```javascript
import { draftPosts } from 'wix-blog-backend';

/*  Sample options value: 
 * {
 *  "action": "UPDATE_PUBLISH",
 *  "draftPosts": [ 
 *    "draftPost": {
 *      "id": "448d1238-0072-4458-a280-bf81c2dd8af1",
 *      "title": "Hello, world"
 *     },
 *     "draftPost": {
 *       "id": "d1c6418d-322b-4976-a815-80ee35c2a5e7",
 *       "title": "Hello to you too"
 *     },
 *   ]
 * }
*/

export async const myBulkUpdateDraftPosts(options) => {
    try {
      const draftPosts = await draftPosts.bulkUpdateDraftPosts(options);
      console.log('Updated draft posts:', draftPosts)
      return draftPosts;
    } catch (error) {
      console.error(error);
      // Handle the error
    }
  };

/* Promise resolves to:
  {
    "bulkActionMetadada": {
      "totalFailures": 0,
      "totalSuccesses": 2,
      "undetailedFailures": 0
    },
    "results": [
      "item": {
          "categoryIds": [],
        "commentingEnabled": true,
        "featured": true,
        "language": "en",
        "media": {
            "custom": false,
            "displayed": true
        },
        "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
        "previewTextParagraph": 2,
        "pricingPlanIds": [],
        "relatedPostIds": [],
        "richContent": {
          "nodes": [
             {
               "type": "PARAGRAPH",
               "id": "pvirv1",
               "nodes": [
                 {
                   "type": "TEXT",
                   "id": "",
                   "nodes": [],
                   "textData": {
                     "text": "Hello world",
                     "decorations": []
                   }
                 }
               ],
               "paragraphData": {}
             }
           ],
        }
        "seoData": {
            "tags": []
        "},
        "seoSlug": "hello-world",
        "tagIds": [],
        "title": "Hello, world"
      },
      "item": {
        "categoryIds": [],
        "commentingEnabled": true,
        "featured": true,
        "language": "en",
        "media": {
            "custom": false,
            "displayed": true
        },
        "memberId": "c00e8a5c-322b-4e77-8813-002e3ea7e811",
        "previewTextParagraph": 2,
        "pricingPlanIds": [],
        "relatedPostIds": [],
        "richContent": {
          "nodes": [
             {
               "type": "PARAGRAPH",
               "id": "pvirv1",
               "nodes": [
                 {
                   "type": "TEXT",
                   "id": "",
                   "nodes": [],
                   "textData": {
                     "text": "Hello to you too",
                     "decorations": []
                   }
                 }
               ],
               "paragraphData": {}
             }
           ],
        }
        "seoData": {
            "tags": []
        "},
        "seoSlug": "hello-to-you-too",
        "tagIds": [],
        "title": "Hello to you too"
      }
    ] 
  }
*/
```

---