Introduction

With the Categories API, you can create and assign various categories to their events. You can use this API to display similar events on different site pages and sorting events in your dashboard. For example, you can create separate pages for jazz, blues, and folk events, but also pages for different venues. The same jazz event can be displayed on your jazz page and also on your downtown location page.

The Categories API allows you to:

Terminology

  • Category: A way to organize or classify events based on their characteristics or themes.
  • Event: A gathering organized by an individual or business for a group of people.
Was this helpful?
Yes
No

Setup

To use the Categories API, install the @wix/events package using npm or Yarn:

Copy
1
npm install @wix/events

or

Copy
1
yarn add @wix/events

Then import { categories } from @wix/events:

Copy
1
import { categories } from '@wix/events'
Was this helpful?
Yes
No

assignEvents( )

Assigns events to a single category.

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.
Returns
Return Type:Promise<void>
Was this helpful?
Yes
No

bulkAssignEvents( )

Assigns events to multiple categories.

Copy
function bulkAssignEvents(categoryId: Array<string>, options: BulkAssignEventsOptions): Promise<BulkAssignEventsResponse>
Method Parameters
categoryIdArray<string>Required
A list of category IDs to which events should be assigned.

optionsBulkAssignEventsOptionsRequired
Optional fields.
Returns
Return Type:Promise<BulkAssignEventsResponse>
Was this helpful?
Yes
No

bulkAssignEventsAsync( )

Assigns filtered events to multiple categories.

Copy
function bulkAssignEventsAsync(categoryId: Array<string>, options: BulkAssignEventsAsyncOptions): Promise<void>
Method Parameters
categoryIdArray<string>Required
Category IDs.

optionsBulkAssignEventsAsyncOptionsRequired
Optional fields.
Returns
Return Type:Promise<void>
Was this helpful?
Yes
No

bulkCreateCategory( )

Creates new categories.

Copy
function bulkCreateCategory(categories: Array<Category>): Promise<BulkCreateCategoryResponse>
Method Parameters
categoriesArray<Category>Required
Categories to create.
Returns
Return Type:Promise<BulkCreateCategoryResponse>
Was this helpful?
Yes
No

bulkUnassignEvents( )

Unassigns events from multiple categories.

Copy
function bulkUnassignEvents(categoryId: Array<string>, options: BulkUnassignEventsOptions): Promise<BulkUnassignEventsResponse>
Method Parameters
categoryIdArray<string>Required
A list of category IDs.

optionsBulkUnassignEventsOptions
Optional fields.
Returns
Return Type:Promise<BulkUnassignEventsResponse>
Was this helpful?
Yes
No

bulkUnassignEventsAsync( )

Unassigns filtered events from multiple categories.

Copy
function bulkUnassignEventsAsync(categoryId: Array<string>, options: BulkUnassignEventsAsyncOptions): Promise<void>
Method Parameters
categoryIdArray<string>Required
Category ID.

optionsBulkUnassignEventsAsyncOptionsRequired
Optional fields.
Returns
Return Type:Promise<void>
Was this helpful?
Yes
No

createCategory( )

Creates a category.

Copy
function createCategory(category: Category): Promise<Category>
Method Parameters
categoryCategoryRequired
Category to create.
Returns
Return Type:Promise<Category>
Was this helpful?
Yes
No

deleteCategory( )

Deletes a category.

Copy
function deleteCategory(categoryId: string): Promise<void>
Method Parameters
categoryIdstringRequired
ID of category to be deleted.
Returns
Return Type:Promise<void>
Was this helpful?
Yes
No

listEventCategories( )

Retrieves a list of categories that are not in the HIDDEN state.

Copy
function listEventCategories(eventId: string): Promise<ListEventCategoriesResponse>
Method Parameters
eventIdstringRequired
Event ID.
Returns
Return Type:Promise<ListEventCategoriesResponse>
Was this helpful?
Yes
No

queryCategories( )

Creates a query to retrieve a list of categories.

The queryCategories() function builds a query to retrieve a list of categories and returns a CategoriesQueryBuilder object.

The returned object contains the query definition, which is typically used to run the query using the find() function.

You can refine the query by chaining CategoriesQueryBuilder functions onto the query. CategoriesQueryBuilder functions enable you to sort, filter, and control the results queryCategories() returns.

queryCategories() runs with these CategoriesQueryBuilder defaults, which you can override:

PROPERTYSUPPORTED FILTERS & SORTING
_ideq()
nameeq()
Copy
function queryCategories(options: QueryCategoriesOptions): CategoriesQueryBuilder
Method Parameters
optionsQueryCategoriesOptions
Optional fields.
Returns
Was this helpful?
Yes
No

unassignEvents( )

Unassigns events from a category.

Copy
function unassignEvents(categoryId: string, eventId: Array<string>): Promise<void>
Method Parameters
categoryIdstringRequired
Category ID.

eventIdArray<string>Required
A list of events IDs.
Returns
Return Type:Promise<void>
Was this helpful?
Yes
No