The quickest way to get started with Watson services is to use the Watson Developer Cloud SDKs. The following GitHub repositories contain installation instructions and basic usage examples:
For example, here's how to make an AlchemyLanguage API call with the Node.js SDK:
Install the SDK:
$ npm install watson-developer-cloud
Save the following code to a file (we'll call it app.js). Make sure you replace API_KEY
with your API key.
// Instantiate the service
var AlchemyLanguageV1= require('watson-developer-cloud/alchemy-language/v1');
var alchemy_language = AlchemyLanguageV1({
api_key: 'API_KEY'
})
var parameters = {
extract: [
'entities',
'keywords'
]
url: 'https://www.ibm.com/us-en/'
};
alchemy_language.combined(parameters, function (err, response) {
if (err)
console.log('error:', err);
else
console.log(JSON.stringify(response, null, 2));
});
Run the app:
$ node app.js