assignEvents( )


Assigns events to a single category.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Events - all permissions
Learn more about app permissions.
Method Declaration
Copy
function assignEvents(
  categoryId: string,
  eventId: Array<string>,
): Promise<void>;
Method Parameters
categoryIdstringRequired

ID of category to which events should be assigned.


eventIdArray<string>Required

A list of events IDs.

JavaScript
import { categories } from "wix-events.v2"; import { webMethod, Permissions } from "wix-web-module"; import { elevate } from "wix-auth"; const elevatedAssignEvents = elevate(categories.assignEvents); /* * Sample categoryId value: "6ec293a8-1b47-4337-9c4e-9a6aeb35e66a", * Sample eventId value: ["4e5e4adb-9778-4171-a9bb-44e27834ac89"] */ export const myAssignEventsFunction = webMethod( Permissions.Anyone, async (categoryId, eventId) => { try { const assignedEvents = await elevatedAssignEvents(categoryId, eventId); console.log("Events are assigned to the category."); return assignedEvents; } catch (error) { console.error(error); // Handle the error } }, ); /* Promise resolves to void */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?