chetanvenkatesh

Lambda @ edge AddressBook Query

Aug 2nd, 2019
162
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var https = require('https');
  2.  
  3. exports.handler = function(event, context, callback) {
  4.  
  5.    
  6.    
  7.     var dataBody = "";
  8.     var jsonObject = JSON.stringify(tBody);
  9.  
  10.  
  11.  
  12.     // the post options
  13.     var optionspost = {
  14.         host: 'demo1.eng1.macrometa.io',
  15.         path: '/_tenant/_mm/_fabric/<tenant name>/restql/execute/showaddresses',
  16.         method: 'POST',
  17.         'body' : '...',
  18.         'isBase64Encoded': false,
  19.         'statusCode': 201,
  20.         'Content-Type': 'application/json',
  21.         headers: {
  22.             'Access-Control-Allow-Credentials': 'true',
  23.             'Access-Control-Allow-Origin' : '*',
  24.             'Authorization': 'bearer THIS__**__IS__**__NOT__**__TH__**__REAL__**__TOKEN. USE__**__THE__**__ONE__**__FROM__**__YOUR__**__OWN__**__ACCOUNT='
  25.         }
  26.     };
  27.  
  28.     var reqPost = https.request(optionspost, function(res) {
  29.         console.log("statusCode: ", res.statusCode);
  30.         res.on('data', function (chunk) {
  31.             dataBody += chunk;
  32.         });
  33.        
  34.         res.on('end', function () {
  35.             //context.succeed(JSON.parse(body));
  36.             callback(null, { statusCode: 200, body: dataBody });
  37.         });
  38.  
  39.     });
  40.    
  41.  
  42.     reqPost.end();
  43. };
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×