You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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/

    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);
    }
    
About

Avatar for Gordon @Gordon started