Posts

Showing posts from July, 2013

How to connect to WSO2 BAM with NodeJs using REST

Recently I wanted to use WSO2 BAM REST API to with NodeJs. After playing sometime with NodeJs API I was able to POST a stream definition to BAM using NodeJs with following method. var https = require('https'); var auth = "Basic " + new Buffer('admin:admin').toString("base64"); //You need to replace admin:admin with your username and password // prepare the header var postheaders = { 'Content-Type': 'application/json', 'Accept': 'application/json', "Authorization": auth }; // the post options var optionspost = { host: '127.0.0.1', port: '9443', path: '/datareceiver/1.0.0/streams/', method: 'POST', rejectUnauthorized: 'false', headers: postheaders }; doPOSTRequest=function(optionspost,jsonObject){ // do the POST call var reqPost = https.request(optionspost, function(re…