Create Thng
Create a Thng with Properties using the EVRYTHNG API.
HTML
<p><div id="thng"></div></p>
JavaScript
var thng = {"name": "My Smart Coffee Machine now",
"description": "Coffee Machine in my room",
"properties": {"cmd": "done"},
"tags": ["demo", "wot"]}
// DO NOT DO THIS IN PROD! This discloses your secret API key, instead
// work with run-time delegated auth, see: https://dev.evrythng.com/documentation/api#apps
// and https://github.com/evrythng/evrythng-js-sdk for examples.
var apiKey = 'YOUR KEY HERE BUT SEE COMMENT ABOVE'
$.ajax({
type: 'POST',
url: 'https://api.evrythng.com/thngs?access_token=' + apiKey,
data: JSON.stringify(thng),
contentType : 'application/json',
accept: 'application/json',
success: function(data) {
$('#thng').html("Thng id: " + data.id + " Property: " + data.properties.cmd);
}
});