Developers

GetCategoryContents

Usage

Use this method to retrieve content within a category sorted as defined in the Knowledge instance:

client.getCategoryContents(categoryId:Integer,options:Object).then(function(response){
    //...
});

Mandatory parameters

Name Type Description
categoryId integer Category identifier from the Knowledge Base. Category id 0 is reserved for the root.

Options

Name Type Default Description
length integer 5 Maximum number of items that may be returned in a collection. Minimum:1. Max:100
offset integer 0 Starting index within the collection of resource result. Minimum:0.

Response data format

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

Example

The following example is set to get a maximum of 10 contents from category 1:

client.getCategoryContents(1, {
    length: 10,
}).then(function(response){
    response.data.results.forEach(function(result) {
        console.log(`Result(${result.id}): ${result.title}`);
    });
});