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){
//...
});
Name | Type | Description |
---|---|---|
categorySlug | string | The name of the category you wish to retrieve from the Knowledge Base. |
This method does not have any options.
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.
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}`);
});
});