The main issue was that you wrote put, not PUT - but otherwise it looks like by default it uses the JSON API. You might be able to append .csv to the URL to fix that though? https://xively.com/dev/docs/api/data/write/multiple_datapoints_to_single_datastream/
put
PUT
.csv
counter = 1; function putXively() { content = JSON.stringify({ version : "1.0.0", datastreams : [ { id:"counter", current_value:counter++ } ] }); var options = { host: 'api.xively.com', port: '80', path:'/v2/feeds/1848857974', method:'PUT', headers: { "X-ApiKey":"RMspyWqYIq1m9vEyuF9Q9BLpngLf4Tr1MlEhmDnHTbAjQvG8", "Content-Length":content.length } }; var req = require("http").request(options, function(res) { res.on('data', function(data) { print("->"+data); setTimeout(putXively, 2000); }); }); req.end(content); }
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The main issue was that you wrote
put
, notPUT
- but otherwise it looks like by default it uses the JSON API. You might be able to append.csv
to the URL to fix that though? https://xively.com/dev/docs/api/data/write/multiple_datapoints_to_single_datastream/