> 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

# BulkRequestReview

# Package: cmsCompliance

# Namespace: CmsComplianceService

# Method link: https://dev.wix.com/docs/api-reference/account-level/enterprise/cms-compliance/compliance-review-request-v1/bulk-request-review.md

## Permission Scopes:
Enterprise CMS compliance flow : SCOPE.ENTERPRISE.CMS-COMPLIANCE-MANAGE

## Introduction

Submits CMS compliance actions on multiple data items for review in a single call.

All the items belong to the collection specified by `collectionId`, and each item takes the same
per-item fields as [Request Review](https://dev.wix.com/docs/api-reference/account-level/enterprise/cms-compliance/compliance-review-request-v1/request-review.md).
A single call can combine different actions. Each item is resolved on its own, so the review request
built for a `PUBLISH_DRAFT` item contains only `proposedDataItem`, while the one built for a
`PUBLISH_CHANGED` item contains both `currentDataItem` and `proposedDataItem`.

The call is all-or-nothing. The service fetches the data item versions for the whole batch together,
so if any item is missing the version its action requires, the call fails with `DATA_ITEMS_NOT_FOUND`.
A failed CMS read fails the call in the same way. In both cases nothing is emitted, and there's no
partial success and no per-item error. When the call succeeds, a single `BulkReviewRequested` event
carries every review request in the order the items were sent.

To submit a single data item for review, call
[Request Review](https://dev.wix.com/docs/api-reference/account-level/enterprise/cms-compliance/compliance-review-request-v1/request-review.md).

---

## REST API

### Schema

```
 Method: bulkRequestReview
 Description: Submits CMS compliance actions on multiple data items for review in a single call.  All the items belong to the collection specified by `collectionId`, and each item takes the same per-item fields as [Request Review](https://dev.wix.com/docs/api-reference/account-level/enterprise/cms-compliance/compliance-review-request-v1/request-review.md). A single call can combine different actions. Each item is resolved on its own, so the review request built for a `PUBLISH_DRAFT` item contains only `proposedDataItem`, while the one built for a `PUBLISH_CHANGED` item contains both `currentDataItem` and `proposedDataItem`.  The call is all-or-nothing. The service fetches the data item versions for the whole batch together, so if any item is missing the version its action requires, the call fails with `DATA_ITEMS_NOT_FOUND`. A failed CMS read fails the call in the same way. In both cases nothing is emitted, and there's no partial success and no per-item error. When the call succeeds, a single `BulkReviewRequested` event carries every review request in the order the items were sent.  To submit a single data item for review, call [Request Review](https://dev.wix.com/docs/api-reference/account-level/enterprise/cms-compliance/compliance-review-request-v1/request-review.md).
 URL: https://www.wixapis.com/cms-compliance/v1/bulk/request-review
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  collectionId, items, items.action, items.dataItemId
 Method parameters: 
   param name: collectionId | type: collectionId | description: GUID of the CMS collection that all the items in the request belong to. | required: true | validation: maxLength 256
   param name: items | type: array<items> | description: Data items to submit for review. Each item belongs to the collection specified by `collectionId`, and the actions in a single request can differ from each other. | required: true | validation: minItems 1, maxItems 100
              - name: action | type: ReviewAction | description: Compliance action performed on the data item. | required: true 
                     - enum:
                     -     PUBLISH_DRAFT: Publish an item that currently exists only as a draft.
                     -     PUBLISH_CHANGED: Publish a draft containing changes to an existing published item.
                     -     UNPUBLISH_PUBLISHED: Unpublish an item that has no pending draft changes.
                     -     PUBLISH_PUBLISHED: Submit an already-published item for review without content changes.
                     -     UNPUBLISH_CHANGED: Unpublish an item that also has pending draft changes.
              - name: dataItemId | type: string | description: GUID of the CMS data item the action was performed on. Matches the item's `_id` in CMS. | required: true | validation: maxLength 128
              - name: versionOnUnpublish | type: VersionOnUnpublish | description: Version to preserve as a draft after `UNPUBLISH_CHANGED`. Ignored for all other actions. If omitted, the review request is still submitted.  
                     - enum:
                     -     KEEP_LATEST_DRAFT_VERSION: Preserve the item's latest draft edits.
                     -     KEEP_LIVE_PUBLISHED_VERSION: Preserve the item's current live version.
 Return type: BulkRequestReviewResponse
  - name: complianceReviewRequests | type: array<ComplianceReviewRequest> | description: Submitted compliance review requests, in the same order as the items in the request. The same objects are emitted together in a single `BulkReviewRequested` event.  | validation: maxItems 100
     - name: id | type: string | description: Compliance review request GUID. Matches the `_id` of the submitted data item.  | read-only: true | validation: format GUID
     - name: action | type: ReviewAction | description: Publishing or unpublishing action the user requested for the data item.  
         - enum:
         -     PUBLISH_DRAFT: Publish an item that currently exists only as a draft.
         -     PUBLISH_CHANGED: Publish a draft containing changes to an existing published item.
         -     UNPUBLISH_PUBLISHED: Unpublish an item that has no pending draft changes.
         -     PUBLISH_PUBLISHED: Submit an already-published item for review without content changes.
         -     UNPUBLISH_CHANGED: Unpublish an item that also has pending draft changes.
     - name: currentDataItem | type: DataItem | description: Published (live) version of the data item. Returned for every action except `PUBLISH_DRAFT`.  | read-only: true 
        - name: id | type: string | description: Data item GUID.  When an item is inserted into a collection, the item's GUID is automatically assigned a random value. You can optionally provide a custom GUID in `dataItem.id` when inserting the item. If you specify an GUID that already exists in the collection, the insertion will fail.  | validation: maxLength 128, immutable
        - name: dataCollectionId | type: string | description: GUID of the collection this item belongs to.  This is the user-defined collection identifier set when the collection is created (for example, `EvalCustomers`), not a GUID.  | read-only: true | validation: maxLength 256
        - name: data | type: object | description: Data item contents.  Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:  + `_id`: Item GUID. + `_createdDate`: Date and time the item was added to the collection. + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value. + `_ownerId`: GUID of the user who created the item. Can be modified with site owner permissions.  
     - name: proposedDataItem | type: DataItem | description: Version of the data item proposed by the request. For `PUBLISH_PUBLISHED`, this is the same published item as `current_data_item`. Absent only for `UNPUBLISH_PUBLISHED`.  | read-only: true 
     - name: submittedAt | type: string | description: Date and time the action was submitted.  | read-only: true | validation: format date-time
     - name: submittedByUserId | type: string | description: GUID of the user who submitted the action.  | read-only: true | validation: format GUID
     - name: submittedByAccountId | type: string | description: GUID of the account the action was submitted under.  | read-only: true | validation: format GUID
     - name: versionOnUnpublish | type: VersionOnUnpublish | description: Version to preserve as a draft after a changed item is unpublished. Returned only for `UNPUBLISH_CHANGED` when the caller provides a meaningful value.  | read-only: true 
         - enum:
         -     KEEP_LATEST_DRAFT_VERSION: Preserve the item's latest draft edits.
         -     KEEP_LIVE_PUBLISHED_VERSION: Preserve the item's current live version.

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_ACTION | Description: An item's `action` is missing or isn't a recognized review action. The whole call is rejected, even if every other item is valid.
   HTTP Code: 401 | Status Code: UNAUTHENTICATED | Application Code: MISSING_IDENTITY | Description: The request identity doesn't include the required account GUID.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: DATA_ITEMS_NOT_FOUND | Description: Couldn't find one or more of the data items in the collection version their `action` requires. The error message lists each missing `dataItemId` and the collection it's missing from. The whole call fails and nothing is emitted.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CMS_METASITE_NOT_RESOLVED | Description: Couldn't resolve the account's CMS metasite. Exactly one `ACCOUNT_MASTER_CMS` metasite must exist for the account.


```

### Examples

### Request review for a batch of data items with different actions
Submits 2 items from the same collection in one call, one PUBLISH_DRAFT and one PUBLISH_CHANGED.

```curl
curl -X POST \
'https://www.wixapis.com/cms-compliance/v1/bulk/request-review' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "collectionId": "Announcements",
  "items": [
    {
      "action": "PUBLISH_DRAFT",
      "dataItemId": "d7a341c4-196b-46e7-813c-2b0fc1847ec6"
    },
    {
      "action": "PUBLISH_CHANGED",
      "dataItemId": "8c1f0b2e-5d47-4a19-9f63-7ab24c5e91d0"
    }
  ]
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.enterpriseCmsCompliance.enterpriseCmsCompliance.bulkRequestReview(collectionId, options)
 Description: Submits CMS compliance actions on multiple data items for review in a single call.  All the items belong to the collection specified by `collectionId`, and each item takes the same per-item fields as [Request Review](https://dev.wix.com/docs/api-reference/account-level/enterprise/cms-compliance/compliance-review-request-v1/request-review.md). A single call can combine different actions. Each item is resolved on its own, so the review request built for a `PUBLISH_DRAFT` item contains only `proposedDataItem`, while the one built for a `PUBLISH_CHANGED` item contains both `currentDataItem` and `proposedDataItem`.  The call is all-or-nothing. The service fetches the data item versions for the whole batch together, so if any item is missing the version its action requires, the call fails with `DATA_ITEMS_NOT_FOUND`. A failed CMS read fails the call in the same way. In both cases nothing is emitted, and there's no partial success and no per-item error. When the call succeeds, a single `BulkReviewRequested` event carries every review request in the order the items were sent.  To submit a single data item for review, call [Request Review](https://dev.wix.com/docs/api-reference/account-level/enterprise/cms-compliance/compliance-review-request-v1/request-review.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  collectionId, options.items, options.items.action, options.items.dataItemId, options
 Method parameters: 
   param name: collectionId | type: string | description: GUID of the CMS collection that all the items in the request belong to. | required: true | validation: maxLength 256
   param name: options | type: BulkRequestReviewOptions  none | required: true 
        - name: items | type: array<Item> | description: Data items to submit for review. Each item belongs to the collection specified by `collectionId`, and the actions in a single request can differ from each other. | required: true | validation: minItems 1, maxItems 100
           - name: action | type: ReviewAction | description: Compliance action performed on the data item.  
                 - enum:
                 -     PUBLISH_DRAFT: Publish an item that currently exists only as a draft.
                 -     PUBLISH_CHANGED: Publish a draft containing changes to an existing published item.
                 -     UNPUBLISH_PUBLISHED: Unpublish an item that has no pending draft changes.
                 -     PUBLISH_PUBLISHED: Submit an already-published item for review without content changes.
                 -     UNPUBLISH_CHANGED: Unpublish an item that also has pending draft changes.
           - name: dataItemId | type: string | description: GUID of the CMS data item the action was performed on. Matches the item's `_id` in CMS.  | validation: maxLength 128
           - name: versionOnUnpublish | type: VersionOnUnpublish | description: Version to preserve as a draft after `UNPUBLISH_CHANGED`. Ignored for all other actions. If omitted, the review request is still submitted.  
                 - enum:
                 -     KEEP_LATEST_DRAFT_VERSION: Preserve the item's latest draft edits.
                 -     KEEP_LIVE_PUBLISHED_VERSION: Preserve the item's current live version.
 Return type: PROMISE<BulkRequestReviewResponse>
  - name: complianceReviewRequests | type: array<ComplianceReviewRequest> | description: Submitted compliance review requests, in the same order as the items in the request. The same objects are emitted together in a single `BulkReviewRequested` event.  | validation: maxItems 100
     - name: _id | type: string | description: Compliance review request GUID. Matches the `_id` of the submitted data item.  | read-only: true | validation: format GUID
     - name: action | type: ReviewAction | description: Publishing or unpublishing action the user requested for the data item.  
         - enum:
         -     PUBLISH_DRAFT: Publish an item that currently exists only as a draft.
         -     PUBLISH_CHANGED: Publish a draft containing changes to an existing published item.
         -     UNPUBLISH_PUBLISHED: Unpublish an item that has no pending draft changes.
         -     PUBLISH_PUBLISHED: Submit an already-published item for review without content changes.
         -     UNPUBLISH_CHANGED: Unpublish an item that also has pending draft changes.
     - name: currentDataItem | type: DataItem | description: Published (live) version of the data item. Returned for every action except `PUBLISH_DRAFT`.  | read-only: true 
        - name: _id | type: string | description: Data item GUID.  When an item is inserted into a collection, the item's GUID is automatically assigned a random value. You can optionally provide a custom GUID in `dataItem.id` when inserting the item. If you specify an GUID that already exists in the collection, the insertion will fail.  | validation: maxLength 128, immutable
        - name: dataCollectionId | type: string | description: GUID of the collection this item belongs to.  This is the user-defined collection identifier set when the collection is created (for example, `EvalCustomers`), not a GUID.  | read-only: true | validation: maxLength 256
        - name: data | type: object | description: Data item contents.  Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:  + `_id`: Item GUID. + `_createdDate`: Date and time the item was added to the collection. + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value. + `_ownerId`: GUID of the user who created the item. Can be modified with site owner permissions.  
     - name: proposedDataItem | type: DataItem | description: Version of the data item proposed by the request. For `PUBLISH_PUBLISHED`, this is the same published item as `current_data_item`. Absent only for `UNPUBLISH_PUBLISHED`.  | read-only: true 
     - name: submittedAt | type: Date | description: Date and time the action was submitted.  | read-only: true 
     - name: submittedByUserId | type: string | description: GUID of the user who submitted the action.  | read-only: true | validation: format GUID
     - name: submittedByAccountId | type: string | description: GUID of the account the action was submitted under.  | read-only: true | validation: format GUID
     - name: versionOnUnpublish | type: VersionOnUnpublish | description: Version to preserve as a draft after a changed item is unpublished. Returned only for `UNPUBLISH_CHANGED` when the caller provides a meaningful value.  | read-only: true 
         - enum:
         -     KEEP_LATEST_DRAFT_VERSION: Preserve the item's latest draft edits.
         -     KEEP_LIVE_PUBLISHED_VERSION: Preserve the item's current live version.

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_ACTION | Description: An item's `action` is missing or isn't a recognized review action. The whole call is rejected, even if every other item is valid.
   HTTP Code: 401 | Status Code: UNAUTHENTICATED | Application Code: MISSING_IDENTITY | Description: The request identity doesn't include the required account GUID.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: DATA_ITEMS_NOT_FOUND | Description: Couldn't find one or more of the data items in the collection version their `action` requires. The error message lists each missing `dataItemId` and the collection it's missing from. The whole call fails and nothing is emitted.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CMS_METASITE_NOT_RESOLVED | Description: Couldn't resolve the account's CMS metasite. Exactly one `ACCOUNT_MASTER_CMS` metasite must exist for the account.


```

### Examples

### Request review for a batch of data items with different actions
Submits 2 items from the same collection in one call, one PUBLISH_DRAFT and one PUBLISH_CHANGED.

```javascript
import { enterpriseCmsCompliance } from "@wix/enterprise-cms-compliance";

async function bulkRequestReview() {
  const response = await enterpriseCmsCompliance.bulkRequestReview(
    "Announcements",
    {
      items: [
        {
          action: "PUBLISH_DRAFT",
          dataItemId: "d7a341c4-196b-46e7-813c-2b0fc1847ec6",
        },
        {
          action: "PUBLISH_CHANGED",
          dataItemId: "8c1f0b2e-5d47-4a19-9f63-7ab24c5e91d0",
        },
      ],
    },
  );
}

/* Promise resolves to:
 * {
 *   "complianceReviewRequests": [
 *     {
 *       "_id": "d7a341c4-196b-46e7-813c-2b0fc1847ec6",
 *       "action": "PUBLISH_DRAFT",
 *       "proposedDataItem": {
 *         "_id": "d7a341c4-196b-46e7-813c-2b0fc1847ec6",
 *         "dataCollectionId": "Announcements__drafts",
 *         "data": {
 *           "_id": "d7a341c4-196b-46e7-813c-2b0fc1847ec6",
 *           "title": "Q3 disclosure",
 *           "status": "draft"
 *         }
 *       },
 *       "submittedAt": "2024-01-15T10:30:00.000Z",
 *       "submittedByUserId": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
 *       "submittedByAccountId": "4f907f5d-bb05-4d99-90a4-7f55d34e9fe8"
 *     },
 *     {
 *       "_id": "8c1f0b2e-5d47-4a19-9f63-7ab24c5e91d0",
 *       "action": "PUBLISH_CHANGED",
 *       "currentDataItem": {
 *         "_id": "8c1f0b2e-5d47-4a19-9f63-7ab24c5e91d0",
 *         "dataCollectionId": "Announcements",
 *         "data": {
 *           "_id": "8c1f0b2e-5d47-4a19-9f63-7ab24c5e91d0",
 *           "title": "Annual compliance statement",
 *           "status": "published"
 *         }
 *       },
 *       "proposedDataItem": {
 *         "_id": "8c1f0b2e-5d47-4a19-9f63-7ab24c5e91d0",
 *         "dataCollectionId": "Announcements__drafts",
 *         "data": {
 *           "_id": "8c1f0b2e-5d47-4a19-9f63-7ab24c5e91d0",
 *           "title": "Annual compliance statement (revised)",
 *           "status": "draft"
 *         }
 *       },
 *       "submittedAt": "2024-01-15T10:30:00.000Z",
 *       "submittedByUserId": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
 *       "submittedByAccountId": "4f907f5d-bb05-4d99-90a4-7f55d34e9fe8"
 *     }
 *   ]
 * }
 */

```

### bulkRequestReview (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { enterpriseCmsCompliance } from '@wix/enterprise-cms-compliance';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { enterpriseCmsCompliance },
  // Include the auth strategy and host as relevant
});


async function bulkRequestReview(collectionId,options) {
  const response = await myWixClient.enterpriseCmsCompliance.bulkRequestReview(collectionId,options);
};
```

---