Created
August 5, 2014 16:45
-
-
Save LuisFDuarte/a200eca4f58ceb4aa5f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
device.on("temp", function(value) { | |
server.log("Trying to post to Ubi the value:"); | |
server.log(value); | |
local headers = { "Content-Type": "application/json", "X-Auth-Token": "NBbF3PWPxWc2IaO40aXOKnhIu8tOv92rYN3ibiEc7Jh6GV3KZUUCHtXuNz7Y" }; // Replace the token with yours | |
local url = "http://things.ubidots.com/api/v1.6/variables/53d2beb37625424630223dac/values"; // Replace the Variable ID with yours | |
local string = {"value": value}; | |
local request = http.post(url, headers, http.jsonencode(string)); | |
local response = request.sendsync(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment