var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'input.digitalstakeout.com',
'path': '/insert',
'headers': {
'Authorization': 'Bearer TokenSecret',
'Content-Type': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"eventAppSource": "digitalstakeout",
"eventAction": "insert",
"eventSrcScreenName": "dso",
"eventSrcAuthor": "DigitalStakeout",
"eventSrcDomain": "digitalstakeout.com",
"eventSrcIP": "1.1.1.1",
"eventGenerator": "website",
"eventDefinedTag": "tag",
"eventPayload": "This is a test."
});
req.write(postData);
req.end();