The sample code in the Agent Guide (http.put to Cosm) returns status code 411 (Length Required). Adding “Content-Length”: “2” to the header section does not help (value = “68”). When I use the same parameters on hurl.it it works like a charm.
device.on("temperature update", function(value) { local req = http.put("http://api.cosm.com/v2/feeds/77185/datastreams/foo.csv", { "Content-Type": "text/csv" }, value) req.sendasync(function(response) { device.send("success", response.statuscode); }); });