Where are you sending the POST to? Are you still connected to the Spark Cloud, or are you hosting your own local cloud?
I’m using the following code: Perhaps you can use some of it.
var deviceID = "<<insert device ID>>";
var accessToken = "<<insert accesstoken>>";
var baseURL = "https://api.spark.io/v1/devices/";
var funcKey = "<<insert function name which you'd like to call>>"
var url = baseURL + deviceID + "/" + funcKey;
$.ajax({
type: "POST",
url: url,
data: {
access_token: accessToken,
args: <<insert your data which you like to send>>
},
dataType: "json"
})
what i used cloud url api will be successful access, the problem only happen on locally cloud call.
@kennethlimcp, what is my wrong for it , i guess, the locally cloud does not support spark cloud api ? if so , could give me some instructions for exactlly differences between locally and remote cloud ? I could nt find this in website.