Developers

GetCategoryBySlug

Usage

Use this method to get the category from the specified category slug in the Knowledge instance:

client.getCategoryBySlug(categorySlug:String,options:Object).then(function(response){
    //...
});

Mandatory parameters

Name Type Description
categorySlug string The name of the category you wish to retrieve from the Knowledge Base.

Options

This method does not have any options.

Response data format

This method calls the Knowledge API’s GET /categories/slug/{slug} endpoint. Please refer to the Responses section of that endpoint on the Knowledge API Routes page for the response format.

Example

The following example will retrieve category "test":

client.getCategoryBySlug('test').then(function(response){
    response.data.results.forEach(function(result) {
        console.log(`Result(${result.id}): ${result.name}`);
    });
});