JSONP callbacks to get data from Paraimpu things

In order to include data coming from Paraimpu actuators in your Web pages or blogs, you need to use a JSONP API callback mechanism. New Paraimpu version include this feature, so you are now able to build your widgets to visualize data and/or populate your pages.

Thus, the API call should be something like this:

http://paraimpu.crs4.it/use?token=<OBJECT_TOKEN>&way=keeping&from_youngest=true&data=full&callback=?

(visit your specific object page in Paraimpu for full API documentation)

For example, using jQuery, you can retreive data, also from multiple things, including in your page a code like in the following snippet.
(Code varies depending on your real object token and produced data).


...
<script type="text/javascript">
           
  url_thing_A = 'http://paraimpu.crs4.it/use?token=<TOKEN_A>&way=keeping&data=full&from_youngest=true&callback=?';

 
url_thing_B = 'http://paraimpu.crs4.it/use?token=<TOKEN_B>&way=keeping&from_youngest=true&data=full&callback=?';

 
url_thing_C = 'http://paraimpu.crs4.it/use?token=<TOKEN_C>&way=keeping&from_youngest=true&data=full&callback=?';

 
 
  $(function() {
   $.getJSON(
url_thing_A, function(data) {
  
    $('#object_A').html(data.payload.my_data_field);
   
   });
  });

 
 
  $(function() {
   $.getJSON(
url_thing_B, function(data) {  
       $('#temperature').html(data.payload.temp);   
   });
  });

 

  $(function() {
   $.getJSON(
url_thing_C, function(data) {  
       $('#wind_speed').html(data.payload.speed);   
   });
  });

 

</script>

...

Leave a Reply

© 2014-2015 Paraimpu Srl . Powered by Blogger.