Use this method to get categories from the root category in the Knowledge instance:
client.getCategories(options:Object).then(function(response){
//...
});
This method does not have any mandatory parameters.
Name | Type | Default | Description |
---|---|---|---|
maxDepth | integer | 1 | Max children depth from category to downwards. Minimum:-1, this value is reserved for unlimited depth. |
This method calls the Knowledge API’s GET /categories
endpoint. Please refer to the Responses section of that endpoint on the Knowledge API Routes page for the response format.
The following example returns all categories:
client.getCategories({
maxDepth: -1
}).then(function(response){
response.data.results.forEach(function(result) {
console.log(`Result(${result.id}): ${result.name}`);
});
});