Skip to content

Instantly share code, notes, and snippets.

@wires
Created September 11, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wires/4459518b55f3733cb13a to your computer and use it in GitHub Desktop.
Save wires/4459518b55f3733cb13a to your computer and use it in GitHub Desktop.
posting to transparantnl
var http = require('http')
var d = {
title: 'TblParlement Levend',
editor: 'Waag Society',
license: 'CC-BY',
description: 'Parlement Levend',
website: 'http://waag.org',
author: 'Waag',
id: 'fo'
};
//console.log(d);
var opts = {
host: 'transparantnederland.nl',
port: 3001,
path: '/datasets',
auth: 'admin:****',
method: 'POST',
headers: { 'Content-Type': 'application/json' },
}
var req = http.request(opts, function(res) {
//res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
res.on('end', function() {
console.log('END')
})
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
// write data to request body
req.write(JSON.stringify(d));
req.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment