> 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 # BulkUnassignEvents # Package: eventManagement # Namespace: CategoryManagement # Method link: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/categories/bulk-unassign-events.md ## Permission Scopes: Manage Events - all permissions: SCOPE.DC-EVENTS-MEGA.MANAGE-EVENTS ## Introduction Unassigns events from multiple categories at once. --- ## REST API ### Schema ``` Method: bulkUnassignEvents Description: Unassigns events from multiple categories at once. URL: https://www.wixapis.com/events/v1/bulk/categories/events Method: DELETE # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: categoryId Method parameters: query param name: categoryId | type: array | description: A list of category GUIDs. | required: true query param name: eventId | type: array | description: A list of events GUIDs. Return type: BulkUnassignEventsResponse - name: results | type: array | description: Results. - name: itemMetadata | type: ItemMetadata | description: Metadata. - name: id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item). - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items. - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated. - name: error | type: ApplicationError | description: Details about the error in case of failure. - name: code | type: string | description: Error code. - name: description | type: string | description: Description of the error. - name: data | type: object | description: Data related to the error. - name: item | type: Category | description: Category. - name: id | type: string | description: Category GUID. - name: name | type: string | description: Category name. - name: createdDate | type: string | description: Date and time when category was created. - name: counts | type: CategoryCounts | description: The total number of draft and published events assigned to the category. - name: assignedEventsCount | type: integer | description: Total number of draft events assigned to the category. - name: assignedDraftEventsCount | type: integer | description: Total number of published events assigned to the category. Deleted events are excluded. - name: states | type: array | description: Category state. Default: `MANUAL`. **Note:** The WIX_EVENTS.MANAGE_AUTO_CATEGORIES permission scope is required to use states other than `MANUAL`. - enum: - MANUAL: Categoty is created manually by the user. - AUTO: Category is created automatically. - RECURRING_EVENT: Category is created automatically when publishing recurring events. - HIDDEN: Category is hidden. - name: bulkActionMetadata | type: BulkActionMetadata | description: Metadata. - name: totalSuccesses | type: integer | description: Number of items that were successfully processed. - name: totalFailures | type: integer | description: Number of items that couldn't be processed. - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded. ``` ### Examples ### BulkUnassignEvents ```curl ~~~cURL curl -X DELETE 'https://www.wixapis.com/events/v1/bulk/categories/events?categoryId=e9779de3-a085-4255-b3a6-9559990d4436&categoryId=027ac25d-cc64-4eb1-8666-4ea53cf7f134&eventId=539a564e-48d2-4eac-8e14-d7a91be6b1c2' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.eventManagement.CategoryManagement.bulkUnassignEvents(categoryId, options) Description: Unassigns events from multiple categories at once. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: categoryId Method parameters: param name: categoryId | type: array | description: A list of category GUIDs. | required: true param name: options | type: BulkUnassignEventsOptions none - name: eventId | type: array | description: A list of events GUIDs. Return type: PROMISE - name: results | type: array | description: Results. - name: itemMetadata | type: ItemMetadata | description: Metadata. - name: _id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item). - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items. - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated. - name: error | type: ApplicationError | description: Details about the error in case of failure. - name: code | type: string | description: Error code. - name: description | type: string | description: Description of the error. - name: data | type: object | description: Data related to the error. - name: item | type: Category | description: Category. - name: _id | type: string | description: Category GUID. - name: name | type: string | description: Category name. - name: _createdDate | type: Date | description: Date and time when category was created. - name: counts | type: CategoryCounts | description: The total number of draft and published events assigned to the category. - name: assignedEventsCount | type: integer | description: Total number of draft events assigned to the category. - name: assignedDraftEventsCount | type: integer | description: Total number of published events assigned to the category. Deleted events are excluded. - name: states | type: array | description: Category state. Default: `MANUAL`. **Note:** The WIX_EVENTS.MANAGE_AUTO_CATEGORIES permission scope is required to use states other than `MANUAL`. - enum: - MANUAL: Categoty is created manually by the user. - AUTO: Category is created automatically. - RECURRING_EVENT: Category is created automatically when publishing recurring events. - HIDDEN: Category is hidden. - name: bulkActionMetadata | type: BulkActionMetadata | description: Metadata. - name: totalSuccesses | type: integer | description: Number of items that were successfully processed. - name: totalFailures | type: integer | description: Number of items that couldn't be processed. - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded. ``` ### Examples ### Remove events from multiple categories (with elevated permissions) ```javascript import { categories } from '@wix/events'; import { auth } from '@wix/essentials'; const elevatedBulkUnassignEvents = auth.elevate(categories.bulkUnassignEvents); /* * Sample categoryId value: ["89d3e8d4-45bc-4439-9e74-7e21b3418c88", "6ec293a8-1b47-4337-9c4e-9a6aeb35e66a"] * Sample options value: * { * "eventId": ["4e5e4adb-9778-4171-a9bb-44e27834ac89"] * } */ export async function myBulkUnassignEventsFunction(categoryId, options) { try { const unassignedEvents = await elevatedBulkUnassignEvents(categoryId, options); console.log('Bulk unassign results: ', unassignedEvents); return unassignedEvents; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "results": [ * { * "itemMetadata": { * "originalIndex": 0, * "success": true, * "_id": "6ec293a8-1b47-4337-9c4e-9a6aeb35e66a" * }, * "item": { * "name": "workshop", * "states": [ * "MANUAL" * ], * "_id": "6ec293a8-1b47-4337-9c4e-9a6aeb35e66a", * "_createdDate": "2022-12-13T11:03:19.174Z" * } * }, * { * "itemMetadata": { * "originalIndex": 1, * "success": true, * "_id": "89d3e8d4-45bc-4439-9e74-7e21b3418c88" * }, * "item": { * "name": "technology", * "states": [ * "MANUAL" * ], * "_id": "89d3e8d4-45bc-4439-9e74-7e21b3418c88", * "_createdDate": "2023-07-12T11:07:35.776Z" * } * } * ], * "bulkActionMetadata": { * "totalSuccesses": 2, * "totalFailures": 0, * "undetailedFailures": 0 * } * } */ ``` ### Remove events from multiple categories ```javascript import { categories } from '@wix/events'; /* * Sample categoryId value: ["89d3e8d4-45bc-4439-9e74-7e21b3418c88", "6ec293a8-1b47-4337-9c4e-9a6aeb35e66a"] * Sample options value: * { * "eventId": ["4e5e4adb-9778-4171-a9bb-44e27834ac89"] * } */ export async function myBulkUnassignEventsFunction(categoryId, options) { try { const unassignedEvents = await categories.bulkUnassignEvents(categoryId, options); console.log('Bulk unassign results: ', unassignedEvents); return unassignedEvents; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "results": [ * { * "itemMetadata": { * "originalIndex": 0, * "success": true, * "_id": "6ec293a8-1b47-4337-9c4e-9a6aeb35e66a" * }, * "item": { * "name": "workshop", * "states": [ * "MANUAL" * ], * "_id": "6ec293a8-1b47-4337-9c4e-9a6aeb35e66a", * "_createdDate": "2022-12-13T11:03:19.174Z" * } * }, * { * "itemMetadata": { * "originalIndex": 1, * "success": true, * "_id": "89d3e8d4-45bc-4439-9e74-7e21b3418c88" * }, * "item": { * "name": "technology", * "states": [ * "MANUAL" * ], * "_id": "89d3e8d4-45bc-4439-9e74-7e21b3418c88", * "_createdDate": "2023-07-12T11:07:35.776Z" * } * } * ], * "bulkActionMetadata": { * "totalSuccesses": 2, * "totalFailures": 0, * "undetailedFailures": 0 * } * } */ ``` ### bulkUnassignEvents (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 { categories } from '@wix/events'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { categories }, // Include the auth strategy and host as relevant }); async function bulkUnassignEvents(categoryId,options) { const response = await myWixClient.categories.bulkUnassignEvents(categoryId,options); }; ``` ---