Back to

Get readings for all sensors of one kit in one request


We use the API, and we need to send one request per sensor_id per device.
Like this example in API documentation :

Do you think it’s possible to add one endpoints in API to get all sensors readings for one kit?

For example, change “sensor_id=7” by “sensor_id=all” or “allsensors”, to get all sensors readings for the device.

Dear @DanZal,

We love you are using the API! Looking forward to see what you are building.

If you are just want to get the latest two readings from a Device you can simply request the Device endpoint:

However we don’t think the feature you are requesting is that important. Requesting the sensors separately allows you to speed up the load since you do not need to load sensors you do not want (i.e. the battery level) also this improves the response time since you can request all the sensors in parallel.

If you tell us the language you are using we can share you an example.

Hope this helps!

Dear @guillem,

Thanks you, I understand the choice of perfomance.

I’m internship, with team, we are building a web app to see all measurement on a territory, like city, department, region. We are developing the double push firmware, it’s able to send data to two web endpoints. This is a wish of redundancy.

For my part of project, I use PHP, javascript, jQuery, AJAX, and d3.js.
With PHP (server side) we get and store kits informations. With javascript (client side) the chart is build from our data base, or from your API. In the first version this can help us to compare if the results are right.

When my part of project will be finished, can I post a new discussion in the general categorie?

Best regards.

Hi @Danzal,

Check here an example about how to retrieve a device and the readings associated using jQuery. This will return you an standard device object but with the sensors objects filled with a readings object with the timeseries data.

Demo code

`getDeviceWithReadings({ deviceId: 4308 }, function(device) {

function getDeviceWithReadings(options, callback) {
API_URL = “”;

var deviceURL = API_URL + /devices/ + options.deviceId;
$.getJSON(deviceURL, function(device) {
var sensorURL = API_URL + /devices/ + options.deviceId + /readings/;
var getReadings = {
return $.getJSON(
rollup: “1d”,
from: device.joined_at,
function(readings) {
sensor.readings = readings;
$.when.apply($, getReadings).done(function() {

Hope this helps you and don’t forget to share the work you are doing!

Hi @guillem, thank you very much. I will see how I can use this in my work. However, I use D3.js to generate graph when the first reading is ready. Yes I don’t forget to share my work.