Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var https = require('https');
- exports.handler = function(event, context, callback) {
- var dataBody = "";
- var jsonObject = JSON.stringify(tBody);
- // the post options
- var optionspost = {
- host: 'demo1.eng1.macrometa.io',
- path: '/_tenant/_mm/_fabric/<tenant name>/restql/execute/showaddresses',
- method: 'POST',
- 'body' : '...',
- 'isBase64Encoded': false,
- 'statusCode': 201,
- 'Content-Type': 'application/json',
- headers: {
- 'Access-Control-Allow-Credentials': 'true',
- 'Access-Control-Allow-Origin' : '*',
- 'Authorization': 'bearer THIS__**__IS__**__NOT__**__TH__**__REAL__**__TOKEN. USE__**__THE__**__ONE__**__FROM__**__YOUR__**__OWN__**__ACCOUNT='
- }
- };
- var reqPost = https.request(optionspost, function(res) {
- console.log("statusCode: ", res.statusCode);
- res.on('data', function (chunk) {
- dataBody += chunk;
- });
- res.on('end', function () {
- //context.succeed(JSON.parse(body));
- callback(null, { statusCode: 200, body: dataBody });
- });
- });
- reqPost.end();
- };
Advertisement
Add Comment
Please, Sign In to add comment