Get two Properties
Get two Properties using the EVRYTHNG API.
by domguinard
HTML
<p>
<span id="resultA"></span> : <span id="resultB"></span>
</p>
JavaScript
var thngId = '5357ac4be4b0eec2cc69487c';
var propertyScoreA = 'scoreA';
var propertyScoreB = 'scoreB';
// 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 = ''
$.ajax({
type: 'GET',
url: 'https://api.evrythng.com/thngs/' + thngId + '/properties/' + propertyScoreA + '?access_token=' + apiKey,
accept: 'application/json',
success: function(data) {
$('#resultA').html(data[0].value);
}
});
$.ajax({
type: 'GET',
url: 'https://api.evrythng.com/thngs/' + thngId + '/properties/' + propertyScoreB + '?access_token=' + apiKey,
accept: 'application/json',
success: function(data) {
$('#resultB').html(data[0].value);
}
});