I have been able to get my data from Xively using REST and am now having issues updating these same values
I need to have data formatted in the following way:
{
"version":"1.0.0",
"datastreams" : [ {
"id" : "example",
"current_value" : "333"
},
{
"id" : "key",
"current_value" : "value"
},
{
"id" : "datastream",
"current_value" : "1337"
}
]
}
I have created the request parameter "datastreams" with two sub-items named "id" and "current_value". I have mapped the running of the script to a button and in the mapping page added the following javascript to the "datastreams" idem:
var data_arr;
var datastreams=[];
datastreams.push({id:'Mode' , current_value:Appery('selectmenu1').val(datastream.current_value)});
datastreams.push({id:'Set_Temp' , current_value:Appery('mobileslider_6').val(datastream.current_value)});
datastreams.push({id:'mode_update' , current_value:'1'});
datastreams.push({id:'set_temp_update' , current_value:'1'});
data_arr.datastreams = datastreams;
return data_arr;
I getan error when testing that datastreams needs to be an array and that my request is the following:
{
"datastreams": {
"id": "",
"current_value": ""
}
}
Any ideas how to accomplish this upload?