Last active
August 17, 2016 08:06
-
-
Save mura-/93e4c9cbd83b34952d3b8be88e9ca122 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var aws = require('aws-sdk'); | |
var https = require('https'); | |
// kintoneの設定 | |
var DOMAIN = 'subdomain.cybozu.com'; | |
var APP_ID = 1; | |
var LOGIN_NAME = 'Your Login name'; | |
var PASSWORD = 'Your Password'; | |
///////////////////////////////////////// | |
var AUTH_VALUE = new Buffer(LOGIN_NAME + ':' + PASSWORD).toString('base64'); | |
var headers = {'X-Cybozu-Authorization': AUTH_VALUE}; | |
exports.handler = function(event, context) { | |
var options = { | |
hostname: DOMAIN, | |
port: 443, | |
path: '/k/v1/records.json?app='+APP_ID, | |
method: 'GET', | |
headers: headers | |
}; | |
var req = https.request(options, function(res) { | |
var data = ""; | |
res.setEncoding('utf8'); | |
res.on('data', function(chunk) { | |
data += chunk; | |
}); | |
res.on('end', function() { | |
context.done(null, JSON.parse(data)); | |
}) | |
}); | |
req.on('error', function(e) { | |
console.log('problem with request: ' + e.message); | |
}); | |
// write data to request body | |
req.end(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment