Setup

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

Copy
1
npm install @wix/forum

or

Copy
1
yarn add @wix/forum

Then import { categories } from @wix/forum:

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

Categories: Supported Filters and Sorting

The following table shows field support for filters and sorting for the Category object:

FieldSupported FiltersSortable
id$eq, $ne, $hasSomeSortable
parentId$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSome
name$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSome
rank$eq, $ne, $lt, $lte, $gt, $gteSortable
headerTitle$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSome
headerType$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSome
description$eq, $ne, $contains, $hasSome, $startsWith, $endsWith, $hasSome
postCount$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSomeSortable
postViewCount$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSomeSortable
slug$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSome

Related content: API Query Language, queryCategories( )

Was this helpful?
Yes
No

getCategory( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Returns a single category by ID.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Forums
Learn more about permission scopes.
Copy
function getCategory(categoryId: string, options: GetCategoryOptions): Promise<Category>
Method Parameters
categoryIdstringRequired
ID of the retrieved category.

optionsGetCategoryOptions
Options specifying which fields to return.
Returns
Return Type:Promise<Category>
Was this helpful?
Yes
No

getCategoryBySlug( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Returns a single category by URL slug.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Forums
Learn more about permission scopes.
Copy
function getCategoryBySlug(slug: string, options: GetCategoryBySlugOptions): Promise<CategoryResponse>
Method Parameters
slugstringRequired
URL slug.

optionsGetCategoryBySlugOptions
Options specifying which fields to return.
Returns
Return Type:Promise<CategoryResponse>
Was this helpful?
Yes
No

queryCategories( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a list of categories, given the provided paging, filtering, and sorting.

Query Categories runs with these defaults, which you can override:

  • paging.limit is 10
  • paging.offset is 0

For field support for filters and sorting, see Categories: Supported Filters and Sorting.

To learn about working with Query endpoints, see API Query Language, Sorting and Paging, and Field Projection.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Forums
Learn more about permission scopes.
Copy
function queryCategories(options: QueryCategoriesOptions): Promise<QueryCategoriesResponse>
Method Parameters
optionsQueryCategoriesOptions
Options for sorting, filtering, paging, and specifying return fields.
Returns
Return Type:Promise<QueryCategoriesResponse>
Was this helpful?
Yes
No