Search...
getCategory( )
Developer Preview
Returns a single category by ID.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function getCategory(categoryId: string, options: GetCategoryOptions): Promise<CategoryResponse>
getCategory Parameters
NAME
TYPE
DESCRIPTION
categoryId
string
ID of the retrieved category.
options
Optional
GetCategoryOptions
Options specifying which fields to return.
Returns
Return Type:
Promise<
CategoryResponse
>NAME
TYPE
DESCRIPTION
category
Category
Retrieved category for the provided category ID.
Was this helpful?
getCategory example
Copy Code
1import { categories } from 'wix-forum.v2';23 async function getCategory(categoryId, options) {4 try {5 const result = await categories.getCategory(categoryId, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13