Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
var request = require('request');
// Set the headers
var headers = {
'<ACCESS-KEY-HEADER>': '<ACCESS-KEY>',
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'
}
// Configure the request
var options = {
url: '<ACCESS-URL>',
method: 'POST',
headers: headers,
form: {
'annotate': 1,
'categories': 1,
'domain': 'retail',
'keywords': 1,
'sentiment': 1,
'text': 'The food was great, but the service was slow.'
}
}
// Start the request
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
// Print out the response body
console.log(body)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment