First, you have to install the watson-developer-cloud
SDK.
$ npm install watson-developer-cloud
We'll use an image of Captain America from Wikipedia.
'use strict';
let watson = require('watson-developer-cloud');
var visualRecognition = watson.visual_recognition({
version: 'v3',
api_key: "<YOUR API KEY GOES HERE>",
version_date:'2016-05-19'
});
let url = "https://upload.wikimedia.org/wikipedia/commons/1/1c/Chris_Evans_filming_Captain_America_in_DC_cropped.jpg"
visualRecognition.classify({url: url}, function(error, results) {
console.log(JSON.stringify(results,null,2));
});