Created
September 11, 2015 14:28
-
-
Save wires/4459518b55f3733cb13a to your computer and use it in GitHub Desktop.
posting to transparantnl
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 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