Use this method to retrieve a content identified by its “slug” (its user-friendly name) from the knowledge base.
client.getContentBySlug(contentSlug:String,options:Object).then(function(response){
//...
});
Name | Type | Description |
---|---|---|
contentSlug | string | Slug (URL) of the content to retrieve |
This method calls the Knowledge API’s GET /contents/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 is set to retrieve all content bearing the slug "test":
client.getContentBySlug('test').then(function(response){
response.data.results.forEach(function(result) {
console.log(`Result(${result.id}): ${result.title}`);
});
});