Search.../

queryCategories( )

Developer Preview

Returns a list of categories by query

Description

Paging

  • limit: default - 10, min - 0, max - 100
  • offset: default - 0, min - 0

Filterable fields:

  • id
  • parentId
  • name
  • rank
  • headerTitle
  • headerType
  • headerDescription
  • postCount
  • postViewCount
  • slug

Sortable fields:

  • rank
  • postCount
  • postViewCount

Syntax

function queryCategories(options: QueryCategoriesOptions): Promise<QueryCategoriesResponse>

queryCategories Parameters

NAME
TYPE
DESCRIPTION
options
Optional
QueryCategoriesOptions

Options for sorting, filtering, paging, and specifying return fields.

Returns

Return Type:

Promise<
QueryCategoriesResponse
>
NAME
TYPE
DESCRIPTION
categories
Array<
Category
>

List of categories.

metaData
QueryCategoriesResponseMetaData

Pagination.

Was this helpful?

queryCategories example

Copy Code
1import { categories } from 'wix-forum.v2';
2
3 async function queryCategories(options) {
4 try {
5 const result = await categories.queryCategories(options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13