Skip to content

Instantly share code, notes, and snippets.

@mura-
Last active Aug 17, 2016
Embed
What would you like to do?
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