Following discovery API Node snippet it seems to exists a bug:
var DiscoveryV1 = require('watson-developer-cloud/discovery/v1');
var discovery = new DiscoveryV1({
username: '{username}',
password: '{password}',
version_date: '2016-12-01'
});
discovery.createCollection(('{environment_id}', '{collection_name}', '{description}' '{configuration_id}'), function(error, data) {
console.log(JSON.stringify(data, null, 2));
});
When I tried:
var params;
params = {description:'test',collection_name:'name test',environment_id:'xxxxxxx',
configuration_id:'xxxxxxx'};
discovery.createCollection(params, function(error, data) {
if(error){
console.log(error);
}
console.log(JSON.stringify(data, null, 2));
});
I got the error: { Error: Invalid or missing collection name, name is a required parameter
It seems to be a documentation or module bug. Did anyone else got the same error? It is working fine using Java Snippet and manually POST/curl