I am experimenting with Electric Imp developer edition card type module
on April breakout board and using Xively to connect
to their service. I pasted in the agent code as expalined and changed
feed id and api key to suit my setup. However, when I build and run agent code, it
always comes back with IDE error on api key line 3 as “scalar expected”.
Can you please tell me what I am doing wrong here and my agent code is attached below ?
`server.log("agent firmware version: " + imp.getsoftwareversion());
const FEED_ID = xxxxxx;
const API_KEY = xxxxxxxxxxxxxxxxxxxxxxxxxxx; //- error message on build = "scalar expected"
function send_xively(body) { //take in csv value
local xively_url = “https://api.xively.com/v2/feeds/” + FEED_ID + “.csv”; //setup url for csv
server.log(xively_url);
server.log(body); //pring body for testing
local req = http.put(xively_url, {“X-ApiKey”:API_KEY, “Content-Type”:“text/csv”, “User-Agent”:“Xively-Imp-Lib/1.0”}, body); //add headers
local res = req.sendsync(); //send request
if(res.statuscode != 200) {
server.log("error sending message: “+res.body);
}else device.send(“status”, (res.statuscode + " OK”)); //sends status to uart. this can be removed if not desired
}
device.on(“data”, function(feedCSV) { //take csv body in from device
server.log(“device on”);
//send preformatted multi-ds csv
send_xively(feedCSV); //send to function to call xively
});`